react-monacoeditor icon indicating copy to clipboard operation
react-monacoeditor copied to clipboard

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

Open jianganglu opened this issue 7 years ago • 4 comments

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 ````

jianganglu avatar Sep 05 '18 07:09 jianganglu

❓ 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

jaywcjlove avatar Sep 05 '18 11:09 jaywcjlove

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 

jianganglu avatar Sep 06 '18 15:09 jianganglu

Monaco Editor Webpack Loader Plugin

A plugin to simplify loading the Monaco Editor with webpack.

@jianganglu

jaywcjlove avatar Sep 06 '18 15:09 jaywcjlove

https://github.com/microsoft/monaco-editor-webpack-plugin/issues/32

tjrobinson avatar Mar 13 '20 16:03 tjrobinson