Closed calico-crusade closed 1 year ago
I couldn't reproduce it with monaco-editor@0.38.0
, nuxt@3.4.2
(also 3.4.3
) and nuxt-monaco-editor@1.2.2
.
Try to remove cache and update all the dependencies: rebuild node_modules
and any lock files.
I'm having the same issue, tried different combinations of versions, including the ones suggested by @e-chan1007.
Here's a minimal reproduction, you can see the errors on the browser inspector (for some reason not on the codesandbox inspector): https://codesandbox.io/p/sandbox/immutable-leftpad-gfspmd
The issue happens on Firefox 111.0.1 (64-bit)
, but not on Chrome 114.0.5735.106 (Official Build) (64-bit)
.
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 [index.js:8:6487](https://codesandbox.io/p/chrome-devtool/protocol/index.js)
SyntaxError: import declarations may only appear at top level of a module 2 [index.js:8:6487](https://codesandbox.io/p/chrome-devtool/protocol/index.js)
SyntaxError: import declarations may only appear at top level of a module [editor.worker.js:5](https://gfspmd-3000.csb.app/node_modules/monaco-editor/esm/vs/editor/editor.worker.js?worker)
SyntaxError: import declarations may only appear at top level of a module 2 [index.js:8:6487](https://codesandbox.io/p/chrome-devtool/protocol/index.js)
SyntaxError: import declarations may only appear at top level of a module [ts.worker.js:15](https://gfspmd-3000.csb.app/node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js?worker)
Uncaught Error: Unexpected usage
loadForeignModule@https://gfspmd-3000.csb.app/_nuxt/node_modules/.pnpm/monaco-editor@0.36.1/node_modules/monaco-editor/esm/vs/editor/common/services
Firefox 111 is 7 versions behind of the latest version 118. Firefox 114 is the first version to support the ES module on web workers, so you need to upgrade the browser to at least that version.
According to Can I use, over 90% of browsers support worker modules, so I have no plans to do anything in nuxt-monaco-editor
.
If you need to support older versions of browsers, some polyfills of worker module might help you.
Trying to use
nuxt-monaco-editor
in nuxt 3.4.2 is throwing a large number of errors in the console when interacting with anything associated with the editor (scrolling, typing, using context menus), however the editor seems to be working correctly?Error Message:
Component:
I have the
nuxt-monaco-editor
in themodules: []
innuxt.config.ts