This might not be a problem in svelte-loader but rather in the svelte compiler, but the issue shows itself in svelte-loader.
When I created a xxx.svelte.js file which got included in my webpack build I started getting a wierd error about Error: callback(): The callback was already called.. But that error turned out to not be the real error, it was just that an error was thrown here:
And since the error occured inside the callback the error became callback(): The callback was already called.
The real error was:
TypeError: Cannot read properties of null (reading 'startsWith')
at contextifySourceUrl (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:124:13)
at /home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:154:3
at Array.map (<anonymous>)
at contextifySourceMap (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:153:39)
at NormalModule.createSource (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:799:5)
at processResult (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:870:24)
at /home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/webpack/lib/NormalModule.js:964:5
at /home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/loader-runner/lib/LoaderRunner.js:407:3
at iterateNormalLoaders (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/loader-runner/lib/LoaderRunner.js:233:10)
at iterateNormalLoaders (/home/anders.ekdahl/source/stickerapp/olympus/atlas/node_modules/loader-runner/lib/LoaderRunner.js:240:10)
I don't know what the cause is here, but if I stop passing js.map to callback() the error goes away so I guess it's something with Svelte 5s sourcemaps for .svelte.js files that causes it.
This is the contents of js.map when the error happens:
This might not be a problem in svelte-loader but rather in the svelte compiler, but the issue shows itself in svelte-loader.
When I created a
xxx.svelte.js
file which got included in my webpack build I started getting a wierd error aboutError: callback(): The callback was already called.
. But that error turned out to not be the real error, it was just that an error was thrown here:https://github.com/sveltejs/svelte-loader/blob/f2a7bc1364939ba2efc51f4400e0a85360f0a123/index.js#L97
Which triggered this line: https://github.com/sveltejs/svelte-loader/blob/f2a7bc1364939ba2efc51f4400e0a85360f0a123/index.js#L101
And since the error occured inside the callback the error became
callback(): The callback was already called
.The real error was:
I don't know what the cause is here, but if I stop passing
js.map
tocallback()
the error goes away so I guess it's something with Svelte 5s sourcemaps for.svelte.js
files that causes it.This is the contents of
js.map
when the error happens: