monaco-editor: [Bug] TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from app/monaco/vs/language/json/jsonWorker.js
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
Reproduction Steps
No response
Actual (Problematic) Behavior
editor.main.js:9 Uncaught Error: Failed to execute ‘fetch’ on ‘WorkerGlobalScope’: Failed to parse URL from app/monaco/vs/language/json/jsonWorker.js
TypeError: Failed to parse URL from app/monaco/vs/language/json/jsonWorker.js at A.load (workerMain.js:6:13847) at n.load (workerMain.js:6:11936) at r (workerMain.js:8:9341) at f._loadModule (workerMain.js:8:9469) at f._resolve (workerMain.js:9:452) at f.defineModule (workerMain.js:8:5564) at f._relativeRequire (workerMain.js:8:6188) at a (workerMain.js:8:8519) at workerMain.js:29:82407 at new Promise (<anonymous>) at A.load (workerMain.js:6:13847) at n.load (workerMain.js:6:11936) at r (workerMain.js:8:9341) at f._loadModule (workerMain.js:8:9469) at f._resolve (workerMain.js:9:452) at f.defineModule (workerMain.js:8:5564) at f._relativeRequire (workerMain.js:8:6188) at a (workerMain.js:8:8519) at workerMain.js:29:82407 at new Promise (<anonymous>) at editor.main.js:9:12
Expected Behavior
No response
Additional Context
This is 52.2 using Chrome latest - using
import loader from ‘@monaco-editor/loader’;
“@monaco-editor/loader”: “^1.4.0”,
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 15 (1 by maintainers)
You can set it as baseUrl
And load it in angular with
It works for me:
I have the same issue.
It happens when a relative path is used for
paths.vsas in this sample.Using an absolute path fixes the issue.
Looks like relative paths are broken somewhere between
0.50.0and0.52.0. Can we get a fix for this soon, or should we use a workaround like manually addingdocument.baseURIas a prefix to the path?I have the same issue, about being unable to load jsonWorker.js.
I’m using angular with this library: https://www.npmjs.com/package/ngx-monaco-editor-v2
Any advice?
Is the case for standalone components? According the description I should use:
MonacoEditorModule.forRoot(monacoConfig)for NgModule?the worker loads used to work in 0.50.0