You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There will still be an issue with how the workers are loaded. Since the monaco-editor/esm/vs/language/typescript/ts.worker.js and monaco-editor/esm/vs/editor/editor.worker.js are ESM modules (they contain imports), they will need to be imported as module Workers:
The editor Worker imports monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js which contains a typeof importScripts check but "the old importScripts() method is not available within module workers"; it will throw:
Uncaught TypeError: Failed to execute 'importScripts' on 'WorkerGlobalScope': Module scripts don't support importScripts().
Alternatively (and probably best until "module Worker" support is better), the workers should be standalone bundled eg. not contain ESM import/export. @alexdima is that something the new ESBuild usage could help with?
Bug/Feature request
I aware that this package currently doesn't support a fully native ESM module because it contains .css/.ttf imports.
The css imports might eventually be okay with CSS module scripts:
There will still be an issue with how the workers are loaded. Since the
monaco-editor/esm/vs/language/typescript/ts.worker.js
andmonaco-editor/esm/vs/editor/editor.worker.js
are ESM modules (they contain imports), they will need to be imported as module Workers:The editor Worker imports
monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js
which contains atypeof importScripts
check but "the old importScripts() method is not available within module workers"; it will throw:Uncaught TypeError: Failed to execute 'importScripts' on 'WorkerGlobalScope': Module scripts don't support importScripts().
(as discovered trying to load workers directly with webpack target esm).
So the worker should use
import
instead ofimportScripts
or be self-contained classic workers.Related issues:
ESM with Vanilla JS:
#2335
ES Modules (vs Webpack):
#949
ESM and CSS loading:
#886
The text was updated successfully, but these errors were encountered: