目前,我已经建立了一个 Vite 2 项目作为monaco-editor依赖项。
每当我尝试使用它时,它都会说工人不是进口的。
editorSimpleWorker.js:454 Uncaught (in promise) Error: Unexpected usage
at EditorSimpleWorker.loadForeignModule (editorSimpleWorker.js:454)
at webWorker.js:38
Run Code Online (Sandbox Code Playgroud)
由于我使用的是 Vite 2,我假设只需rollup-plugin-monaco-editor在插件数组中指定汇总插件即可。但是,我仍然遇到这个问题。
editorSimpleWorker.js:454 Uncaught (in promise) Error: Unexpected usage
at EditorSimpleWorker.loadForeignModule (editorSimpleWorker.js:454)
at webWorker.js:38
Run Code Online (Sandbox Code Playgroud)
有没有合适的方法导入monaco-editor到Vite 2项目中?