dont fetch online sourcemaps on runtime
Describe the bug
many javascript files in lib/vscode/resources/ have online sourcemaps
example:
$ tail -n1 /nix/store/0y692yyqc4gdx0i6k22hc7nzswxqqg9p-vscodium-1.71.2.22258/lib/vscode/resources/app/out/bootstrap.js
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/cea9d1a4b17966719d8c5f3cdd914480f7cec47c/core/bootstrap.js.map
this is unwanted because
- vscodium should work offline
- vscodium should not call home to windows.net (telemetry)
Please confirm that this problem is VSCodium-specific
- [ ] This bug doesn't happen if I use Microsoft's Visual Studio Code. It only happens in VSCodium.
Please confirm that the issue/resolution isn't already documented
- [x] I checked the Docs page and my issue is not mentioned there.
Additional context Add any other context about the problem here.
on nixos linux ...
find /nix/store/0y692yyqc4gdx0i6k22hc7nzswxqqg9p-vscodium-1.71.2.22258/lib/vscode/resources/ -name '*.js' | xargs tail -n1 -q | sed 's|//# sourceMappingURL=|\n&|g' | grep -E -o 'https://.*?\.js\.map' >/tmp/vscodium-online-sourcemaps.txt
@milahu yes, they are loaded only if you open the Developer Tools in the Help menu. Should we keep them? I don't know.
also some stack traces will (try to) fetch these sourcemaps
sourcemaps are useful for debugging, so ideally, prefetch the sourcemaps on build, and patch the urls
some stack traces will (try to) fetch these sourcemaps
... to ${workdir}/sourcemaps, but this fails in my case
debug console:
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/vs/loader.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/vs/loader.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/vs/loader.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/vs/loader.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/vs/base/common/performance.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/vs/base/common/performance.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/bootstrap-node.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/bootstrap-node.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/bootstrap-amd.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/bootstrap-amd.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/bootstrap.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/bootstrap.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/bootstrap-fork.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/bootstrap-fork.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/vs/workbench/api/node/extensionHostProcess.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/vs/workbench/api/node/extensionHostProcess.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/out/vs/workbench/api/node/extensionHostProcess.nls.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/core/vs/workbench/api/node/extensionHostProcess.nls.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/extensions/debug-auto-launch/dist/extension.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/extensions/debug-auto-launch/dist/extension.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/extensions/ipynb/dist/ipynbMain.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/extensions/ipynb/dist/ipynbMain.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/extensions/emmet/dist/node/emmetNodeMain.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/extensions/emmet/dist/node/emmetNodeMain.js.map'
Could not read source map for file:///nix/store/xzpplq37c76fnjyl3nzgwdpb038yqvhx-vscodium-1.72.0.22279/lib/vscode/resources/app/extensions/merge-conflict/dist/mergeConflictMain.js: ENOENT: no such file or directory, open '/tmp/project/sourcemaps/9f4a41aac91eb148c23b6956be66db333af2d3a2/extensions/merge-conflict/dist/mergeConflictMain.js.map'
... caused by debugging an vscode extension (vscode-nix-ide)
To be useful, the sourcemaps need to hosted somewhere since MS don't include them since they would increase the install size of the app.
vscodium should work offline
Since the url needs to be hardcoded, to use a local url would be difficult (for all systems). And the weight of those files can be an issue to include them adhoc.
It only an issue to debug vscode or one of its components.
Since the url needs to be hardcoded, to use a local url would be difficult (for all systems)
sourceMappingURL can be a filename, then its relative to dirname
MS don't include them since they would increase the install size of the app.
maybe we can compress them as .js.map.gz?
but there is another problem ...
all URLs produce HTTP 404, because sourcemaps are only generated in macos builds, and there is no macos build for my vscode versions
- 1.71.2.22258 = cea9d1a4b17966719d8c5f3cdd914480f7cec47c
- 1.72.0.22279 = 9f4a41aac91eb148c23b6956be66db333af2d3a2
https://github.com/microsoft/vscode/issues/39824 https://github.com/Microsoft/vscode/issues/43487
sourceMappingURLcan be a filename, then its relative to dirname
I know... but the app is installed at different locations. Unless if we can specify a standard location like the user profile or in the same directory as the extensions, it will be difficult.
Then, you will need to download a tar.gz or zip file and uncompress the maps to that location.
Maybe a script that do all of that??? Locate the app, get the version, download the maps and update the urls.... ???
Hum, Snap, AppImage and macOS might be an issue.
all URLs produce HTTP 404, because sourcemaps are only generated in macos builds, and there is no macos build for my vscode versions
Yeah, I forgot... it must be linked the BUILD_SOURCEVERSION which is now different between VSCode and VSCodium (due to the release number) So a solution is needed, either remove them or find a solution to have them locally...
So a solution is needed, either remove them or find a solution to have them locally...
Generating them with the CI build and ideally have them uploaded along with changing the URL. Additional: a script that change the URLs to the home directory and the option to download them packed.
... wishful thinking ...
One may just turn off "Enable JavaScript source maps" in the Chromium Dev Tools settings:

This is electron.devtools.preferences.jsSourceMapsEnabled: "true" | "false" (yes, string),
in the <user data directory, see this>/Preferences file, a JSON file without a proper .json suffix.
Since we have good reasons, maybe we can just preload this preference and tell user about this change somewhere.
But...
This is related to a larger topic: Should the Web Dev Tools fetch source maps automatically? Should source map errors be printed on the main console?
Personally, I want Dev Tools do nothing when I launch them, but fetch the source map when I inspect a source. The source map fetch errors should be printed to somewhere else, like Firefox's browser console. Maybe just leave one info level message on the main console, to indicate there is source map error(s) on this Dev Tools instance.
Source map is just for convenience, not essential. It shoule be fetched on demand, not unconditionally.
To be useful, the sourcemaps need to hosted somewhere since MS don't include them since they would increase the install size of the app.
vscodium should work offline
Since the url needs to be hardcoded, to use a local url would be difficult (for all systems). And the weight of those files can be an issue to include them adhoc.
It only an issue to debug vscode or one of its components.
I think this needs to be an option- I can't debug my vscodium without these source maps, so they should be included. For the VSCodium that's downloadable on GitHub, we can assume nobody will use the source map so the sourceMappingURL line can be removed, or the domain name replaced with a .invalid domain.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment, and we'll keep it open. If you have any new additional information, please include it with your comment!
+1
but there is another problem ...
all URLs produce HTTP 404, because sourcemaps are only generated in macos builds
or you know... build vscodium from source #887 #420
one downside is the long build time
this could be reduced by replacing tsc with swc, see also https://github.com/microsoft/vscode/pull/163660
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment, and we'll keep it open. If you have any new additional information, please include it with your comment!
+1