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

svelte.ts files webpack serve error #242

Open
philippone opened this issue Oct 12, 2024 · 0 comments
Open

svelte.ts files webpack serve error #242

philippone opened this issue Oct 12, 2024 · 0 comments

Comments

@philippone
Copy link

When running a webpack application with svelte.ts files the webpack build is working (and seems to be running correctly) but webpack serve producing the following error:

/workspace/test/template-webpack/node_modules/loader-runner/lib/LoaderRunner.js:146
                if(isError) throw e;
                            ^

TypeError: Cannot read properties of null (reading 'startsWith')
    at contextifySourceUrl (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:143:13)
    at /Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:173:3
    at Array.map (<anonymous>)
    at contextifySourceMap (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:172:39)
    at NormalModule.createSource (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:844:5)
    at processResult (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:928:24)
    at /Users/philipp.schardt/workspace/test/template-webpack/node_modules/webpack/lib/NormalModule.js:1034:5
    at /Users/philipp.schardt/workspace/test/template-webpack/node_modules/loader-runner/lib/LoaderRunner.js:407:3
    at iterateNormalLoaders (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/loader-runner/lib/LoaderRunner.js:233:10)
    at iterateNormalLoaders (/Users/philipp.schardt/workspace/test/template-webpack/node_modules/loader-runner/lib/LoaderRunner.js:240:10)

Reproduction repo

  • npm run build is working correctly
  • npm run dev produces the error
  • Dev task is working when removing the import of test.svelte in App.svelte

Btw, I guess the alias in webpack config in the README should be removed for Svelte 5.
svelte/src/runtime seems to be removed.

alias: {
      svelte: path.resolve('node_modules', 'svelte/src/runtime') // Svelte 3: path.resolve('node_modules', 'svelte')
    },
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