Skip to content

Commit

Permalink
Don't output CSS on Next server builds (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcompiles committed Sep 28, 2022
1 parent 6667c74 commit dfc6405
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/spicy-planes-approve.md
@@ -0,0 +1,7 @@
---
'@vanilla-extract/next-plugin': patch
---

Fix `Cannot find module *.css.ts.vanilla.css` issue

Previously, CSS was being output on both the client and server builds. This fix ensure CSS is only output on the client build.
4 changes: 3 additions & 1 deletion packages/next-plugin/src/index.js
Expand Up @@ -50,7 +50,9 @@ export const createVanillaExtractPlugin =
),
});

config.plugins.push(new VanillaExtractPlugin(pluginOptions));
config.plugins.push(
new VanillaExtractPlugin({ outputCss: !isServer, ...pluginOptions }),
);

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

0 comments on commit dfc6405

Please sign in to comment.