Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unexpected usage at EditorSimpleWorkerImpl.BaseEditorSimpleWorker.loadForeignModule (editorSimpleWorker.js:391) #1

Open
jianganglu opened this issue Sep 5, 2018 · 4 comments

Comments

@jianganglu
Copy link

Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker
Error: Unexpected usage
at EditorSimpleWorkerImpl.BaseEditorSimpleWorker.loadForeignModule (editorSimpleWorker.js:391)
at webWorker.js:38
at ShallowCancelThenPromise.CompletePromise_then [as then] (winjs.base.js:1587)
at MonacoWebWorkerImpl._getForeignProxy (webWorker.js:37)
at MonacoWebWorkerImpl.getProxy (webWorker.js:61)
at WorkerManager.webpackJsonp.2144.WorkerManager._getClient (workerManager.js:51)
at WorkerManager.webpackJsonp.2144.WorkerManager.getLanguageServiceWorker (workerManager.js:62)
at DocumentLinkAdapter.worker [as _worker] (htmlMode.js:15)
at DocumentLinkAdapter.webpackJsonp.2145.DocumentLinkAdapter.provideLinks (languageFeatures.js:322)
at getLinks.js:69
at Array.map ()
at getLinks (getLinks.js:68)
at links.js:246
at Object.createCancelablePromise [as i] (async.js:33)
at LinkDetector. (links.js:246)
at step (links.js:55)
at Object.next (links.js:36)
at links.js:30
at new Promise ()
at __awaiter (links.js:26)
at LinkDetector.beginCompute (links.js:234)
at LinkDetector.onModelModeChanged (links.js:227)
at links.js:206
at Emitter.fire (event.js:105)
at LanguageFeatureRegistry.register (languageFeatureRegistry.js:44)
at Object.registerLinkProvider (standaloneLanguages.js:313)
at Object.setupMode (htmlMode.js:21)
at monaco.contribution.js:89
at Object.notifySuccess [as _notify] (winjs.base.js:1191)
at Object.enter (winjs.base.js:867)
at _Base.Class.derive._creator._run (winjs.base.js:1089)
at _Base.Class.derive._creator._completed (winjs.base.js:1057)
at ````

@jaywcjlove
Copy link
Member

❓ I see the warning "Could not create web worker". What should I do?

HTML5 does not allow pages loaded on file:// to create web workers. Please load the editor with a web server on http:// or https:// schemes.

@jianganglu

@jianganglu
Copy link
Author

jianganglu commented Sep 6, 2018

Thank you for your prompt reply. Besides, I have a Problem that i can't resolve it, can you help me ? :(
that I use create-react-app or dva to create my react project, but i can't use it at same time. At runtime, the error is

Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker
Error: Unexpected usage
at EditorSimpleWorkerImpl.BaseEditorSimpleWorker.loadForeignModule (editorSimpleWorker.js:391)
at webWorker.js:38
at ShallowCancelThenPromise.CompletePromise_then [as then] (winjs.base.js:1587)
at MonacoWebWorkerImpl._getForeignProxy (webWorker.js:37)
at MonacoWebWorkerImpl.getProxy (webWorker.js:61)
at WorkerManager.webpackJsonp.2144.WorkerManager._getClient (workerManager.js:51)
at WorkerManager.webpackJsonp.2144.WorkerManager.getLanguageServiceWorker (workerManager.js:62)
at DocumentLinkAdapter.worker [as _worker] (htmlMode.js:15)
at DocumentLinkAdapter.webpackJsonp.2145.DocumentLinkAdapter.provideLinks (languageFeatures.js:322)
at getLinks.js:69
at Array.map ()
at getLinks (getLinks.js:68)
at links.js:246
at Object.createCancelablePromise [as i] (async.js:33)
at LinkDetector. (links.js:246)
at step (links.js:55)
at Object.next (links.js:36)
at links.js:30
at new Promise ()
at __awaiter (links.js:26)
at LinkDetector.beginCompute (links.js:234)
at LinkDetector.onModelModeChanged (links.js:227)
at links.js:206
at Emitter.fire (event.js:105)
at LanguageFeatureRegistry.register (languageFeatureRegistry.js:44)
at Object.registerLinkProvider (standaloneLanguages.js:313)
at Object.setupMode (htmlMode.js:21)
at monaco.contribution.js:89
at Object.notifySuccess [as _notify] (winjs.base.js:1191)
at Object.enter (winjs.base.js:867)
at _Base.Class.derive._creator._run (winjs.base.js:1089)
at _Base.Class.derive._creator._completed (winjs.base.js:1057)
at 

@jaywcjlove
Copy link
Member

jaywcjlove commented Sep 6, 2018

Monaco Editor Webpack Loader Plugin

A plugin to simplify loading the Monaco Editor with webpack.

@jianganglu

@tjrobinson
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants