monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] Missing sourcemap files since v0.52

Open kermanx opened this issue 1 year ago • 20 comments

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?

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.

kermanx avatar Oct 16 '24 02:10 kermanx

I also face this problem when using webpack.

hieunguyen2211 avatar Nov 21 '24 09:11 hieunguyen2211

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)

silverwind avatar Dec 06 '24 18:12 silverwind

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'

adl-vb avatar Dec 15 '24 17:12 adl-vb

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'

kaiyoma avatar Feb 04 '25 18:02 kaiyoma

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\#'

danielzhe avatar Feb 18 '25 21:02 danielzhe

+1

nick-romano avatar Feb 21 '25 00:02 nick-romano

+1 too

mattgodbolt avatar Apr 21 '25 20:04 mattgodbolt

+1

kaloslazo avatar Jun 05 '25 04:06 kaloslazo

+1

NathanDeWitte avatar Jul 07 '25 07:07 NathanDeWitte

+1

danielgran avatar Jul 09 '25 17:07 danielgran

+1

NexusOnePlus avatar Jul 12 '25 15:07 NexusOnePlus

+1

jamestalton avatar Jul 22 '25 12:07 jamestalton

+1

javs1979 avatar Aug 01 '25 22:08 javs1979

+1

benjaminknauer avatar Aug 13 '25 12:08 benjaminknauer

+1

woutersteven avatar Aug 27 '25 09:08 woutersteven

+1

tIsGoud avatar Sep 08 '25 11:09 tIsGoud

Seems fixed with 0.53.0.

silverwind avatar Sep 09 '25 22:09 silverwind

Closing as it seems to have been fixed.

hediet avatar Sep 10 '25 09:09 hediet

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

kermanx avatar Sep 17 '25 15:09 kermanx

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.map
  • node_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.

silverwind avatar Sep 17 '25 15:09 silverwind