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
[vite] Internal server error: Failed to resolve import "../../editor/editor.worker.js" from ".angular\vite-root\CoreHTML\monaco-json.worker.js". Does the file exist?
I tried using the amd version but it is not compatible with some of our dependencies, for example, it breaks mathjs due to the global define function created by the monaco-editor loader.
The text was updated successfully, but these errors were encountered:
Carlosamouco
changed the title
application builder fails to load imports with *?worker and prebudling set to false.application builder fails to load imports with *?worker when prebudling is set to false.
Mar 20, 2024
This is expected as ?worker is vite specific and will only work during development for dependencies that are optimized by Vite. This approach however will not work for a production build.
To make this work you need to do the following;
Create a file example json.worker.ts
In this file add an import to the worker import 'monaco-editor/esm/vs/language/json/json.worker';
Create the worker using the following syntax new Worker(new URL('./json.worker', import.meta.url));
Command
build, serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I tried to import
monaco-editor
using it's ESM version and theapplication
builder.It requires to import a set of workers for example:
After adding
vite/client
to thetypes
section intsconfig.json
it compiles and works fine.However, if I run the build command with prebundle set to false, I start having errors:
As an workaround I tried adding a script in angular.json:
But when I run:
I get the following error:
I tried using the amd version but it is not compatible with some of our dependencies, for example, it breaks
mathjs
due to the globaldefine
function created by the monaco-editor loader.Minimal Reproduction
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: