Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with .svelte.js files and Svelte 5 #238

Open
andersekdahl opened this issue Apr 25, 2024 · 0 comments
Open

Issue with .svelte.js files and Svelte 5 #238

andersekdahl opened this issue Apr 25, 2024 · 0 comments

Comments

@andersekdahl
Copy link

andersekdahl commented Apr 25, 2024

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:

callback(null, js.code, js.map);

Which triggered this line:

callback(new Error(`${err.name}: ${err.toString()}`));

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:

{
  version: 3,
  names: [],
  sources: [ null ],
  sourcesContent: [ null ],
  mappings: ';;;aAAa,OAAO;uBACG,IAAI;;KAAvB,SAAS;;;;KAAT,SAAS;;;;6BACgB,KAAK;;KAA9B,eAAe;;;;KAAf,eAAe;;;;6BACU,KAAK;;KAA9B,eAAe;;;;KAAf,eAAe;;;;CACf,eAAe;;;KACf,4BAA4B;;;;KAA5B,4BAA4B;;;;;;KAC5B,6BAA6B;;;;KAA7B,6BAA6B;;;;;;KAC7B,gBAAgB;;;;KAAhB,gBAAgB;;;;;;KAChB,qBAAqB;;;;KAArB,qBAAqB;;;;;;KACrB,yBAAyB;;;;KAAzB,yBAAyB;;;;;;KACzB,6BAA6B;;;;KAA7B,6BAA6B;;;;;;KAC7B,oCAAoC;;;;KAApC,oCAAoC;;;;;SAExB,IAAI,CAAC,qBAAqB,CAAC,MAAM,IACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,IACrC,IAAI,CAAC,6BAA6B,CAAC,MAAM,IACzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,EAAE,MAAM;;;KAJrE,iBAAiB;;;;;QAYP,WAAW;;aACN,eAAe,IAAI,IAAI,CAAC,gBAAgB;SACzC,MAAM;OACR,UAAU,GAAG,CAAC;;cACP,IAAI,IAAI,eAAe,CAAC,KAAK;SAC/B,MAAM,CAAC,IAAI,CAAC,gBAAgB;KAC7B,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC;;;IAErC,MAAM,CAAC,IAAI,CAAC,gBAAgB;;QACxB,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,UAAU;KAC1C,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB;;;;GAGjD,WAAW,CAAC,eAAe,CAAC,EAAE,IAAI,U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IAAI,CAAC,qBAAqB;;;GAEzD,MAAM,CAAC,IAAI,CAAC,GAAG;;;SAEZ,MAAM;;;KA1CjB,cAAc;;;;CA4Cd,WAAW;EAAC,eAAe;EAAE,2BAA2B;EAAE,0BAA0B;;EAChF,IAAI,CAAC,eAAe,GAAG,eAAe;;MAClC,2BAA2B;mDACU,2BAA2B;;;MAEhE,0BAA0B;kDACU,0BAA0B;;;'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant