Skip to content

Commit

Permalink
Fix Monaco worker unable to start
Browse files Browse the repository at this point in the history
Problem due to cross-origin loading of the worker script.

The worker script is now bundled as inline data, at the expense of the bundle
size, which increased from 8MB to 10MB.

PS This is only a quick fix, NOT definitive. There is probably a better way to
do it.
  • Loading branch information
syimyuzya committed Sep 8, 2024
1 parent 5f40d63 commit a0dd922
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"import/no-unresolved": ["error", { "ignore": ["\\?(?:worker|raw)$"] }]
"import/no-unresolved": ["error", { "ignore": ["\\?(?:worker(&inline)?|raw)$"] }]
}
}
2 changes: 1 addition & 1 deletion src/editor/initialize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { languages } from "monaco-editor";
import TSWorker from "monaco-editor/esm/vs/language/typescript/ts.worker.js?worker";
import TSWorker from "monaco-editor/esm/vs/language/typescript/ts.worker.js?worker&inline";
import { SuggestAdapter } from "monaco-editor/esm/vs/language/typescript/tsMode";

declare global {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function makeConfig(assetLocation = base) {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
build: {
chunkSizeWarningLimit: 8192,
chunkSizeWarningLimit: 10240,
outDir: "build",
},
experimental: {
Expand Down

0 comments on commit a0dd922

Please sign in to comment.