Skip to content

Commit dfc6405

Browse files
authored
Don't output CSS on Next server builds (#852)
1 parent 6667c74 commit dfc6405

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/spicy-planes-approve.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@vanilla-extract/next-plugin': patch
3+
---
4+
5+
Fix `Cannot find module *.css.ts.vanilla.css` issue
6+
7+
Previously, CSS was being output on both the client and server builds. This fix ensure CSS is only output on the client build.

packages/next-plugin/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const createVanillaExtractPlugin =
5050
),
5151
});
5252

53-
config.plugins.push(new VanillaExtractPlugin(pluginOptions));
53+
config.plugins.push(
54+
new VanillaExtractPlugin({ outputCss: !isServer, ...pluginOptions }),
55+
);
5456

5557
if (typeof nextConfig.webpack === 'function') {
5658
return nextConfig.webpack(config, options);

0 commit comments

Comments
 (0)