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

Unable to display multiple editors when using the monaco-editor package

Open corydeppen opened this issue 3 years ago • 0 comments

Describe the bug

I've been running into an issue when trying to display more than one editor on a page. The editors are rendered as expected when the loader script from the CDN is added to the page, but I need to use the loader from the monaco-editor package because I get the following error when the Cypress tests run in CI:

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://cdn.jsdelivr.net/npm/[email protected]/min/vs/base/worker/workerMain.js' failed to load.

I may be misunderstanding how to override the loader config and initialize Monaco, so I'm hoping you'd be able to review the following example and let me know if I may have missed something or if there may be something else wrong that's preventing multiple editors from being displayed when using the monaco-editor package instead of the CDN script.

To Reproduce

https://stackblitz.com/edit/vitejs-vite-hx5puv?file=src/App.tsx

Expected behavior

Multiple editors should be displayed with the appropriate content regardless of which loader is used.

corydeppen avatar Apr 27 '22 20:04 corydeppen