mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 12:54:00 -05:00
Version 7.1.1 (released Oct 10, 2025) breaks Monaco editor when static
assets are served from a CDN (cross-origin). Workers fail to load with
"Cannot use import statement outside a module" errors.
Root Cause:
-----------
When workers are loaded cross-origin, the webpack plugin creates a blob
worker to work around browser security restrictions. In 7.1.1, the blob
generation code (lines 178-184 in webpack-plugin/src/index.ts) checks:
if (typeof import.meta !== 'undefined') {
js += 'import "' + workerUrl + '";'; // ES6 module syntax
} else {
js += 'importScripts("' + workerUrl + '");'; // Classic syntax
}
This check runs at BUILD TIME (in the webpack runtime context), not in
the worker context. If import.meta is defined in the build environment,
it generates ES6 import syntax. However, the blob is still created as a
CLASSIC worker (not {type: 'module'}), causing the syntax error.
Why It Works Locally:
---------------------
When serving from the same origin (localhost), the plugin returns the
worker URL directly without creating a blob, bypassing this buggy code.
CDN deployments always trigger the cross-origin blob worker path.
Symptoms:
---------
- Browser console: "Could not create web worker(s). Falling back to..."
- No worker.js files requested from CDN (falls back before trying)
- Monaco editor loads but with degraded functionality
- Console errors: "Uncaught SyntaxError: Cannot use import statement
outside a module" from blob URLs
The bug was introduced in commit ae5cab7 (PR #4742) which attempted to
add module worker support but broke the cross-origin blob worker path.
Upgrade Path:
-------------
Can upgrade when either:
1. monaco-editor-webpack-plugin releases a fix (watch PR #4742 discussion)
2. We switch to same-origin worker delivery (not using CDN for workers)
Pinning to exact version 7.1.0 (no caret) to prevent auto-upgrade until
this is resolved upstream.
Related upstream issues:
- https://github.com/microsoft/monaco-editor/issues/4741
- https://github.com/microsoft/monaco-editor/pull/4742
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
171 lines
5.7 KiB
JSON
171 lines
5.7 KiB
JSON
{
|
|
"name": "compiler-explorer",
|
|
"description": "Interactively investigate compiler output",
|
|
"type": "module",
|
|
"private": true,
|
|
"author": {
|
|
"name": "Matt Godbolt",
|
|
"email": "matt@godbolt.org",
|
|
"url": "https://xania.org"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "compiler-explorer/compiler-explorer"
|
|
},
|
|
"version": "0.0.3",
|
|
"engines": {
|
|
"node": ">=20.0.0"
|
|
},
|
|
"main": "./app.ts",
|
|
"dependencies": {
|
|
"@aws-sdk/client-dynamodb": "^3.914.0",
|
|
"@aws-sdk/client-ec2": "^3.914.0",
|
|
"@aws-sdk/client-s3": "^3.914.0",
|
|
"@aws-sdk/client-sqs": "^3.914.0",
|
|
"@aws-sdk/client-ssm": "^3.914.0",
|
|
"@aws-sdk/credential-providers": "^3.914.0",
|
|
"@flatten-js/interval-tree": "^1.1.4",
|
|
"@fortawesome/fontawesome-free": "^7.1.0",
|
|
"@orchidjs/sifter": "^1.1.0",
|
|
"@popperjs/core": "^2.11.8",
|
|
"@sentry/browser": "^10.21.0",
|
|
"@sentry/node": "^10.21.0",
|
|
"@types/semver": "^7.7.1",
|
|
"big-integer": "^1.6.52",
|
|
"bootstrap": "^5.3.8",
|
|
"buffer": "^6.0.3",
|
|
"chart.js": "^4.5.1",
|
|
"clipboard": "^2.0.11",
|
|
"commander": "^14.0.1",
|
|
"compression": "^1.8.1",
|
|
"copy-webpack-plugin": "^13.0.1",
|
|
"cross-env": "^10.1.0",
|
|
"enhanced-ms": "^4.1.0",
|
|
"events": "^3.3.0",
|
|
"express": "^5.1.0",
|
|
"file-saver": "^2.0.5",
|
|
"golden-layout": "^1.5.9",
|
|
"http-proxy": "^1.18.1",
|
|
"jquery": "^3.7.1",
|
|
"js-cookie": "^3.0.5",
|
|
"jszip": "^3.10.1",
|
|
"lodash.clonedeep": "^4.5.0",
|
|
"lru-cache": "^11.2.2",
|
|
"lz-string": "^1.5.0",
|
|
"marked": "^16.4.1",
|
|
"monaco-editor": "^0.49.0",
|
|
"monaco-vim": "^0.4.2",
|
|
"morgan": "^1.10.1",
|
|
"node-targz": "^0.2.0",
|
|
"p-queue": "^9.0.0",
|
|
"path-browserify": "^1.0.1",
|
|
"profanities": "^3.0.1",
|
|
"prom-client": "^15.1.3",
|
|
"pug": "^3.0.3",
|
|
"response-time": "^2.3.4",
|
|
"sanitize-filename": "^1.6.3",
|
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
"semver": "^7.7.3",
|
|
"systemd-socket": "0.0.0",
|
|
"tar-stream": "^3.1.7",
|
|
"tom-select": "^2.4.3",
|
|
"tree-kill": "^1.2.2",
|
|
"triple-beam": "^1.4.1",
|
|
"tsx": "^4.20.6",
|
|
"underscore": "^1.13.7",
|
|
"url-join": "^5.0.0",
|
|
"whatwg-fetch": "^3.6.20",
|
|
"which": "^5.0.0",
|
|
"winston": "^3.18.3",
|
|
"winston-loki": "^6.1.3",
|
|
"winston-papertrail": "^1.0.5",
|
|
"winston-transport": "^4.9.0",
|
|
"ws": "^8.18.3",
|
|
"yaml": "^2.8.1"
|
|
},
|
|
"devDependencies": {
|
|
"@biomejs/biome": "^2.2.7",
|
|
"@sentry/types": "^10.21.0",
|
|
"@smithy/util-stream": "^4.5.3",
|
|
"@types/bootstrap": "^5.2.10",
|
|
"@types/chai": "^5.2.3",
|
|
"@types/compression": "^1.8.1",
|
|
"@types/express": "^5.0.3",
|
|
"@types/file-saver": "^2.0.7",
|
|
"@types/http-proxy": "^1.17.16",
|
|
"@types/jquery": "^3.5.33",
|
|
"@types/js-cookie": "^3.0.6",
|
|
"@types/node-targz": "^0.2.4",
|
|
"@types/request": "^2.48.13",
|
|
"@types/response-time": "^2.3.9",
|
|
"@types/supertest": "^6.0.3",
|
|
"@types/temp": "^0.9.4",
|
|
"@types/underscore": "^1.13.0",
|
|
"@types/webpack-env": "^1.18.8",
|
|
"@types/which": "^3.0.4",
|
|
"@types/ws": "^8.18.1",
|
|
"@vitest/coverage-v8": "^3.2.4",
|
|
"aws-sdk-client-mock": "^4.1.0",
|
|
"cheerio": "^1.1.2",
|
|
"css-loader": "^7.1.2",
|
|
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
"cypress": "^15.5.0",
|
|
"file-loader": "^6.2.0",
|
|
"happy-dom": "^20.0.8",
|
|
"husky": "^9.1.7",
|
|
"lint-staged": "^16.2.5",
|
|
"mini-css-extract-plugin": "^2.9.4",
|
|
"mock-fs": "^5.5.0",
|
|
"monaco-editor-webpack-plugin": "7.1.0",
|
|
"nock": "^14.0.10",
|
|
"npm-run-all": "^4.1.5",
|
|
"sass": "^1.93.2",
|
|
"sass-loader": "^16.0.5",
|
|
"source-map-loader": "^5.0.0",
|
|
"supertest": "^7.1.4",
|
|
"terser-webpack-plugin": "^5.3.14",
|
|
"ts-loader": "^9.5.4",
|
|
"typescript": "^5.9.3",
|
|
"vitest": "^3.0.7",
|
|
"vitest-fetch-mock": "^0.4.5",
|
|
"webpack": "^5.102.1",
|
|
"webpack-cli": "^6.0.1",
|
|
"webpack-dev-middleware": "^7.4.5",
|
|
"webpack-manifest-plugin": "^5.0.1"
|
|
},
|
|
"optionalDependencies": {
|
|
"@rollup/rollup-darwin-arm64": "*",
|
|
"@rollup/rollup-darwin-x64": "*",
|
|
"@rollup/rollup-linux-x64-gnu": "*",
|
|
"@rollup/rollup-linux-x64-musl": "*",
|
|
"@rollup/rollup-win32-x64-msvc": "*"
|
|
},
|
|
"scripts": {
|
|
"cypress": "cypress run",
|
|
"lint": "biome check . --write",
|
|
"lint-check": "biome check .",
|
|
"test-coverage": "vitest run --coverage",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test-min": "cross-env SKIP_EXPENSIVE_TESTS=true vitest run",
|
|
"check": "npm run ts-check && npm run lint-check && npm run check-frontend-imports && npm run test-min -- --reporter dot",
|
|
"check-frontend-imports": "node ./etc/scripts/check-frontend-imports.js",
|
|
"dev": "cross-env NODE_ENV=DEV node --no-warnings=ExperimentalWarning --import=tsx app.ts",
|
|
"debugger": "cross-env NODE_ENV=DEV node --import=tsx --inspect-brk app.ts",
|
|
"debug": "cross-env NODE_ENV=DEV node --no-warnings=ExperimentalWarning --import=tsx app.ts --debug",
|
|
"start": "npm run webpack && cross-env NODE_ENV=LOCAL node --no-warnings=ExperimentalWarning --import=tsx app.ts",
|
|
"sentry": "npx -p @sentry/cli sentry-cli",
|
|
"update-browserslist": "npx browserslist@latest -- --update-db",
|
|
"prepare": "husky",
|
|
"ts-compile": "tsc",
|
|
"ts-check": "npm-run-all ts-check:*",
|
|
"ts-check:backend": "tsc -p ./tsconfig.backend.json --noEmit",
|
|
"ts-check:frontend": "tsc -p ./tsconfig.frontend.json --noEmit",
|
|
"ts-check:tests": "tsc -p ./tsconfig.tests.json --noEmit",
|
|
"ts-check:frontend-tests": "tsc -p ./tsconfig.frontend.tests.json --noEmit",
|
|
"webpack": "node --no-warnings=ExperimentalWarning --import=tsx ./node_modules/webpack-cli/bin/cli.js --node-env=production --config webpack.config.esm.ts"
|
|
},
|
|
"license": "BSD-2-Clause",
|
|
"packageManager": "npm@11.2.0"
|
|
}
|