See josdejong/svelte-jsoneditor#476 (comment)
Relevant files:
src/lib/index.ts
src/lib/Test.svelte
rollup.config.js
test.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
serve
and opentest.html
in 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.json
and 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.html
in your browser. Now, you'll see the "hello world" message and no errors in the browser console.