marvinhagemeister / karma-esbuild

Preprocessor based on esbuild for the karma test runner
MIT License
21 stars 10 forks source link

Sourcemaps are not accessible via karma server #46

Open thatsmydoing opened 2 years ago

thatsmydoing commented 2 years ago

Trying to access the sourcemap from the karma server fails with a 404

It seems the esbuild config needs to have

publicPath: '/base'

to deal with the prefix that karma puts everything under. This makes the sourceMappingURL injected into the bundle correct.

In addition to that, the bundlerMap stores file names with their absolute path but the esbuild middleware looks it up using a relative path so it can never find the sourcemap.

marvinhagemeister commented 2 years ago

Thanks for reporting this issue and the debugging hints. I've come across that one myself and attempted a fix in #37 , but haven't had the time so far to get that PR ready. Would love some help.