If you don't define emitCss in the config passed to rollup-plugin-svelte, and you're using svelte@5.0.0-next.1, and your component is missing a .css file, then an error is thrown:
[!] (plugin svelte) TypeError: Cannot read properties of null (reading 'code')
Hello.svelte
at Object.transform (/workspace/rollup-demo/node_modules/rollup-plugin-svelte/index.js:154:32)
at /workspace/rollup-demo/node_modules/rollup/dist/shared/rollup.js:1008:40
If you don't define
emitCss
in the config passed torollup-plugin-svelte
, and you're usingsvelte@5.0.0-next.1
, and your component is missing a.css
file, then an error is thrown:The error is thrown from this line:
https://github.com/sveltejs/rollup-plugin-svelte/blob/ed67842e80bcb07fd3ebcc1060ae2ef4f23e78e3/index.js#L154
This same error does not occur with Svelte v4.
Here is a minimal repro.
You can repro by doing:
Node and npm versions:
As a workaround, you can set
emitCss: false
in the config.