Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't output CSS on Next server builds #852

Merged
merged 1 commit into from
Sep 28, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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