diff --git a/.changeset/spicy-planes-approve.md b/.changeset/spicy-planes-approve.md new file mode 100644 index 000000000..b47f38927 --- /dev/null +++ b/.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. \ No newline at end of file diff --git a/packages/next-plugin/src/index.js b/packages/next-plugin/src/index.js index 0bd3a6be4..e26488095 100644 --- a/packages/next-plugin/src/index.js +++ b/packages/next-plugin/src/index.js @@ -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);