Comments (2)
I’m not familiar with worker-plugin
. I think the following should help you troubleshoot:
- Could you verify
yamlWorkerUrl
is defined by logging it to the console? - Is
worker-plugin
configured in your webpack configuration? - No only
monaco-yaml
needs to be handled byMonacoEnvironment.getWorkerUrl()
, but also any other workers created by Monaco.
https://github.com/pengx17/monaco-yaml/blob/090302534ae205d3a7163375bf211be5e8dd5eda/examples/webpack/src/index.js#L10-L17
In your case this should be something like:import editorWorkerUrl from 'worker-plugin/loader?name=yaml&esModule!onaco-editor/esm/vs/editor/editor.worker'; import yamlWorkerUrl from 'worker-plugin/loader?name=yaml&esModule!monaco-yaml/lib/esm/yaml.worker'; window.MonacoEnvironment = { getWorkerUrl(moduleId, label) { if (label === 'yaml') { return yamlWorkerUrl; } return editorWorkerUrl; } };
One additional tip: If you import 'monaco-editor'
to get all features, you may as well import { editor } from 'monaco-editor'
instead of from monaco-editor/esm/vs/editor/editor.api
.
from monaco-yaml.
I’m going to close this issue, because Webpack 5 supports web workers out of the box without the need for any special loaders or plugins. Please see the updated example.
monaco-yaml/examples/webpack/src/index.js
Lines 10 to 27 in 3094ebe
from monaco-yaml.
Related Issues (20)
- how to use `yaml` as an embedded language HOT 4
- Autompletion not working in Example HOT 2
- support prettier v3 HOT 2
- configureyaml is not working with @monaco-editor/react HOT 12
- References fail to resolve when using locally defined schema with `enableSchemaRequest` set to false HOT 1
- Ability to tweak autocompletion HOT 1
- monaco-yaml在销毁的时候调用dispose()后控制台报错 HOT 1
- [ BUG ] Next.JS 14.1 Can't load worker file HOT 1
- [ NEED HELP ] window is not defined on NextJS 14.1.0 HOT 3
- How to load with @monaco-editor/loader? HOT 1
- Does this library is support with monaco editor AMD version HOT 4
- Enum autocomplete didn't put string inside quote HOT 1
- Uncaught (in promise) Error: Worker manager has been disposed HOT 3
- The error message for the enumeration type is incorrect HOT 2
- Error since 5.2.0 / "export 'toSelectionRanges' (imported as 'toSelectionRanges') was not found in 'monaco-languageserver-types'" HOT 2
- Yaml worker can't read properties of undefined HOT 4
- Missing this package “monaco-marker-data-provider” HOT 8
- Is it possible to detect multiple schemas in one editor? HOT 1
- toSelectionRanges was not found in 'monaco-languageserver-types' HOT 1
- Error `toSelectionRanges` is not exported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monaco-yaml.