Skip to content

Commit

Permalink
Restrict VanillaExtract plugin to playroom's source .css.ts files o…
Browse files Browse the repository at this point in the history
…nly (#377)

Co-authored-by: Adam Skoufis <[email protected]>
Co-authored-by: Adam Skoufis <[email protected]>
  • Loading branch information
3 people authored Nov 18, 2024
1 parent a6895e0 commit fb14616
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/slow-plums-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'playroom': patch
---

Restrict `playroom`'s Vanilla Extract plugin to only process playroom's `.css.ts` files
10 changes: 9 additions & 1 deletion lib/makeWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,15 @@ module.exports = async (playroomConfig, options) => {
filename: 'preview/index.html',
publicPath: '../',
}),
new VanillaExtractPlugin(),
new VanillaExtractPlugin({
test: (filePath) => {
// Only apply VanillaExtract plugin to playroom's source `.css.ts` files
return (
/\.css\.ts$/i.test(filePath) &&
includePaths.some((includePath) => filePath.startsWith(includePath))
);
},
}),
new MiniCssExtractPlugin({ ignoreOrder: true }),
...(options.production ? [] : [new FriendlyErrorsWebpackPlugin()]),
// If using a version of React earlier than 18, ignore the
Expand Down

0 comments on commit fb14616

Please sign in to comment.