6

I'm building an Electron desktop app (which uses Chromium) with Typescript. The Chromium dev tools seem to be looking in the wrong place for source maps.

I'm on Windows, and the application is served using file://

The generated files have the source map location relative to the location of the .js file. For example /myapp/dist/components/loginview.js has sourceMappingURL=loginview.js.map, and the mapping file is located in the same directory as the JS file.

Chromium, however, is looking for the mapping file in the root of the application (alongside the currently loaded HTML file). For the above example, it emits this warning:

DevTools failed to parse SourceMap: file:///myapp/dist/loginview.js.map

In this case, I would expect dev tools to look in "file:///myapp/dist/components/loginview.js.map" instead.

I've tried various options in tsconfig.json, including mapRoot and rootDir, but nothing seems to change the generated URL.

I'm not sure if the solution lies in configuring typescript to emit the subfolder name in the source mapping URL, or configuring chromium to resolve the URL relative to the js file. I have been unable to find a way to do either.

2
  • Did you find a solution in the meantime?
    – Dominic
    Jul 20, 2021 at 20:14
  • @Dominic I'm afraid not, sorry
    – andypaxo
    Jul 20, 2021 at 22:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.