Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/funny-banks-bet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@modular-css/vite": patch
---

fix: vite@8 build compatibility

Vite plugins can return `moduleSideEffects` from their `transform` hook, but with the switch to Rolldown for built output the valid arguments changed.
7 changes: 3 additions & 4 deletions packages/vite/vite.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ module.exports = (
return this.error(e);
}

const { code : css, namedExports, warnings } = transform(file, processor, pluginOptions);
const { code : css, warnings } = transform(file, processor, pluginOptions);

warnings.forEach((warning) => {
this.warn(warning);
Expand Down Expand Up @@ -253,9 +253,8 @@ module.exports = (
code : result,
map : emptyMappings,

// Disable tree-shaking for CSS modules w/o any classes/values to export
// to make sure they're included in the bundle
moduleSideEffects : Boolean(namedExports.length) || "no-treeshake",
// Disable tree-shaking for CSS modules to make sure they're included in the bundle
moduleSideEffects : true,
};
},
};
Expand Down