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.