[Bug] Missing sourcemap files since v0.52
Reproducible in vscode.dev or in VS Code Desktop?
- [x] Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- [x] Not reproducible in the monaco editor playground
Description
There is a //# sourceMappingURL=marked.umd.js.map at the end of https://cdn.jsdelivr.net/npm/[email protected]/esm/vs/base/common/marked/marked.js. But the source map file is actually missing/not published, which causes bundlers like Vite throwing errors of "Failed to load source map for /.../node_modules/monaco-editor/esm/vs/base/common/marked/marked.js".
Before v0.52.0-rc2, there wasn't sourceMappingURL comments, so everything was fine.
If required, I am glad to provide a minimal reproduction of using monaco-editor with Vite, but this seems to be not very useful for this specific issue.
I also face this problem when using webpack.
Same problem with vite:
7:04:46 PM [vite] Failed to load source map for node_modules/monaco-editor/esm/vs/base/common/marked/marked.js.
Error: An error occurred while trying to read the map file at marked.umd.js.map
Error: ENOENT: no such file or directory, open 'node_modules/monaco-editor/esm/vs/base/common/marked/marked.umd.js.map'
at async open (node:internal/fs/promises:639:25)
at async Object.readFile (node:internal/fs/promises:1239:14)
at async extractSourcemapFromFile (file:///node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:21001:53)
at async loadAndTransform (file:///node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51892:27)
Same issue:
Failed to parse source map from 'C:\Users\username\Git\Databricks\frontend\node_modules\monaco-editor\esm\vs\base\common\marked\marked.umd.js.map' file: Error: ENOENT: no such file or directory, open 'C:\Users\username\Git\Databricks\frontend\node_modules\monaco-editor\esm\vs\base\common\marked\marked.umd.js.map'
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
WARNING in ./node_modules/monaco-editor/esm/vs/base/common/marked/marked.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\username\Git\Databricks\frontend\node_modules\monaco-editor\esm\vs\base\common\marked\marked.umd.js.map' file: Error: ENOENT: no such file or directory, open 'C:\Users\username\Git\Databricks\frontend\node_modules\monaco-editor\esm\vs\base\common\marked\marked.umd.js.map'
Seeing this when running unit tests through Vitest:
[9:48:29 AM] ■ Starting task test
Running all tests...
> npx vitest run --color --config ./vitest.config.ts
RUN v2.1.8 C:/Users/kgetz/Work/event-viewer/lib/geiger-forms
9:48:42 AM [vite] Failed to load source map for C:/Users/kgetz/Work/event-viewer/common/temp/node_modules/.pnpm/[email protected]/node_modules/monaco-editor/esm/vs/base/common/marked/marked.js.
Error: An error occurred while trying to read the map file at marked.umd.js.map
Error: ENOENT: no such file or directory, open 'C:\Users\kgetz\Work\event-viewer\common\temp\node_modules\.pnpm\[email protected]\node_modules\monaco-editor\esm\vs\base\common\marked\marked.umd.js.map'
I just upgraded to the 0.52.2 and I'm facing the same error:
WARNING in ../monaco-editor/dist/standalone/monaco.min.js
│ Module Warning (from ../../node_modules/.pnpm/[email protected][email protected]/node_modules/source-map-loader/dist/cjs.js):
│ Failed to parse source map from 'E:\my-project\packages\monaco-editor\dist\standalone\marked.umd.js.map\n\n\n\#' file: Error: ENOENT: no such file or directory, open 'E:\my-project\packages\monaco-editor\dist\standalone\marked.umd.js.map\n\n\n\#'
+1
+1 too
+1
+1
+1
+1
+1
+1
+1
+1
+1
Seems fixed with 0.53.0.
Closing as it seems to have been fixed.
I am afraid that the same problem seems to persist in the latest 0.53.0.
You can verify this by visiting https://www.npmjs.com/package/monaco-editor?activeTab=code and navigate to monaco-editor/esm/vs/base/common/marked/marked.js
Yes, I think I spoke too soon. my npx vite build is now apparently clean of these errors but during npx vitest, I see error logging for these two missing source map files:
node_modules/monaco-editor/esm/vs/base/common/marked/marked.esm.js.mapnode_modules/monaco-editor/esm/vs/base/browser/dompurify/purify.es.mjs.map
Could be some logging configuration issue on my end that it does not show during the build, but I think it's safe to say there is some bug still in the sourcemap generation of this module.