JO
josdejong/test-svelte5-rollup
Test issue with rollup bundle not working with Svelte 5
See josdejong/svelte-jsoneditor#476 (comment)
Relevant files:
src/lib/index.tssrc/lib/Test.svelterollup.config.jstest.html
Steps to reproduce the issue with Svelte 5:
-
Install dependencies via
npm install --force -
Run in develop mode to verify that the Svelte app itself works:
npm run dev, then open your browser and check that you see "Test Component message: Hello world" -
Build the bundle via
npm run build -
Start a local server like
serveand opentest.htmlin your browser. You should see the same message "Hello world" as in (2) but that is not the case. Open your browser console, that will show an error like:Uncaught TypeError: props is undefined prop props.js:226 Test Test.svelte:2 <anonymous> test.html:32
To verify that the rollup bundling works with Svelte 4:
- Open
package.jsonand change the version of"svelte"from"5.0.0-next.205"to"4.2.18". - Run
npm install - Execute steps (3) and (4) again:
npm run build, then opentest.htmlin your browser. Now, you'll see the "hello world" message and no errors in the browser console.
On this page
Languages
HTML38.4%JavaScript36.0%Svelte19.0%TypeScript6.6%
Contributors
Created August 1, 2024
Updated August 1, 2024