Skip to content

Commit 9b5e8ec

Browse files
committed
fix: prevent crash when css is null in Svelte 5
fixes #216
1 parent fe52a2d commit 9b5e8ec

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 7.2.0
44

55
- Support compiling `svelte.js/ts` files in Svelte 5
6+
- Prevent crash when `css` is `null` in Svelte 5 ([#216](https://github.com/sveltejs/rollup-plugin-svelte/issues/216))
67

78
## 7.1.6
89

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ module.exports = function (options = {}) {
169169
else this.warn(warning);
170170
});
171171

172-
if (emitCss && compiled.css.code) {
172+
if (emitCss && compiled.css && compiled.css.code) {
173173
const fname = id.replace(new RegExp(`\\${extension}$`), '.css');
174174
compiled.js.code += `\nimport ${JSON.stringify(fname)};\n`;
175175
cache_emit.set(fname, compiled.css);

0 commit comments

Comments
 (0)