@vanilla-extract/next-plugin 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var webpackPlugin = require('@vanilla-extract/webpack-plugin');
6
6
  var browserslist = require('browserslist');
7
7
  var css = require('next/dist/build/webpack/config/blocks/css');
8
- var loaders = require('next/dist/build/webpack/config/blocks/css/loaders');
8
+ var findPagesDir = require('next/dist/lib/find-pages-dir');
9
+ var nextMiniCssExtractPluginExports = require('next/dist/build/webpack/plugins/mini-css-extract-plugin');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
12
 
12
13
  var browserslist__default = /*#__PURE__*/_interopDefault(browserslist);
14
+ var nextMiniCssExtractPluginExports__default = /*#__PURE__*/_interopDefault(nextMiniCssExtractPluginExports);
13
15
 
16
+ // Next.js' built-in mini-css-extract-plugin has a very terrible type definition, let's just use any
17
+ const NextMiniCssExtractPlugin =
18
+ // @ts-expect-error -- Next.js' precompilation does add "__esModule: true", but doesn't add an actual default exports
19
+ nextMiniCssExtractPluginExports__default["default"].default;
14
20
  function getSupportedBrowsers(dir, isDevelopment) {
15
21
  let browsers;
16
22
  try {
@@ -21,33 +27,108 @@ function getSupportedBrowsers(dir, isDevelopment) {
21
27
  } catch {}
22
28
  return browsers;
23
29
  }
30
+ // https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L7
31
+ const getVanillaExtractCssLoaders = (options, assetPrefix) => {
32
+ const loaders = [];
33
+
34
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L14
35
+ if (!options.isServer) {
36
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/client.ts#L44
37
+ // next-style-loader will mess up css order in development mode.
38
+ // Next.js appDir doesn't use next-style-loader either.
39
+ // So we always use css-loader here, to simplify things and get proper order of output CSS
40
+ loaders.push({
41
+ loader: NextMiniCssExtractPlugin.loader,
42
+ options: {
43
+ publicPath: `${assetPrefix}/_next/`,
44
+ esModule: false
45
+ }
46
+ });
47
+ }
48
+ const postcss = () => css.lazyPostCSS(options.dir, getSupportedBrowsers(options.dir, options.dev), undefined);
49
+
50
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L28
51
+ loaders.push({
52
+ loader: require.resolve('next/dist/build/webpack/loaders/css-loader/src'),
53
+ options: {
54
+ postcss,
55
+ importLoaders: 1,
56
+ modules: false
57
+ }
58
+ });
59
+
60
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L43
61
+ loaders.push({
62
+ loader: require.resolve('next/dist/build/webpack/loaders/postcss-loader/src'),
63
+ options: {
64
+ postcss
65
+ }
66
+ });
67
+ return loaders;
68
+ };
24
69
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
25
70
  webpack(config, options) {
26
- var _nextConfig$experimen;
71
+ var _resolvedNextConfig$e, _resolvedNextConfig$e2;
27
72
  const {
28
73
  dir,
29
74
  dev,
30
- isServer
75
+ isServer,
76
+ config: resolvedNextConfig
31
77
  } = options;
78
+ const findPagesDirResult = findPagesDir.findPagesDir(dir, (_resolvedNextConfig$e = resolvedNextConfig.experimental) === null || _resolvedNextConfig$e === void 0 ? void 0 : _resolvedNextConfig$e.appDir);
79
+
80
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/index.ts#L336
81
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/webpack-config.ts#L626
82
+ // https://github.com/vercel/next.js/pull/43916
83
+ const hasAppDir =
84
+ // on Next.js 12, findPagesDirResult is a string. on Next.js 13, findPagesDirResult is an object
85
+ !!((_resolvedNextConfig$e2 = resolvedNextConfig.experimental) !== null && _resolvedNextConfig$e2 !== void 0 && _resolvedNextConfig$e2.appDir) && !!(findPagesDirResult && findPagesDirResult.appDir);
86
+ const outputCss = hasAppDir ?
87
+ // Always output css since Next.js App Router needs to collect Server CSS from React Server Components
88
+ true :
89
+ // There is no appDir, do not output css on server build
90
+ !isServer;
32
91
  const cssRules = config.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
33
92
  test
34
93
  }) => typeof test === 'object' && typeof test.test === 'function' && test.test('filename.css'))).oneOf;
35
94
  cssRules.unshift({
36
95
  test: /\.vanilla\.css$/i,
37
96
  sideEffects: true,
38
- use: loaders.getGlobalCssLoader({
39
- assetPrefix: config.assetPrefix,
40
- isClient: !isServer,
41
- isServer,
42
- isDevelopment: dev,
43
- future: nextConfig.future || {},
44
- experimental: nextConfig.experimental || {},
45
- // @ts-ignore -- 'appDir' config is in beta
46
- hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
47
- }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
97
+ use: getVanillaExtractCssLoaders(options, resolvedNextConfig.assetPrefix)
48
98
  });
99
+
100
+ // vanilla-extract need to emit the css file on both server and client, both during the
101
+ // development and production.
102
+ // However, Next.js only add MiniCssExtractPlugin on pages dir + client build + production mode.
103
+ //
104
+ // To simplify the logic at our side, we will add MiniCssExtractPlugin based on
105
+ // the "instanceof" check (We will only add our required MiniCssExtractPlugin if
106
+ // Next.js hasn't added it yet).
107
+ // This also prevent multiple MiniCssExtractPlugin being added (which will cause
108
+ // RealContentHashPlugin to panic)
109
+ if (!config.plugins.some(plugin => plugin instanceof NextMiniCssExtractPlugin)) {
110
+ // HMR reloads the CSS file when the content changes but does not use
111
+ // the new file name, which means it can't contain a hash.
112
+ const filename = dev ? 'static/css/[name].css' : 'static/css/[contenthash].css';
113
+ config.plugins.push(new NextMiniCssExtractPlugin({
114
+ filename,
115
+ chunkFilename: filename,
116
+ // Next.js guarantees that CSS order "doesn't matter", due to imposed
117
+ // restrictions:
118
+ // 1. Global CSS can only be defined in a single entrypoint (_app)
119
+ // 2. CSS Modules generate scoped class names by default and cannot
120
+ // include Global CSS (:global() selector).
121
+ //
122
+ // While not a perfect guarantee (e.g. liberal use of `:global()`
123
+ // selector), this assumption is required to code-split CSS.
124
+ //
125
+ // If this warning were to trigger, it'd be unactionable by the user,
126
+ // but likely not valid -- so just disable it.
127
+ ignoreOrder: true
128
+ }));
129
+ }
49
130
  config.plugins.push(new webpackPlugin.VanillaExtractPlugin({
50
- outputCss: !isServer,
131
+ outputCss,
51
132
  ...pluginOptions
52
133
  }));
53
134
  if (typeof nextConfig.webpack === 'function') {
@@ -5,12 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var webpackPlugin = require('@vanilla-extract/webpack-plugin');
6
6
  var browserslist = require('browserslist');
7
7
  var css = require('next/dist/build/webpack/config/blocks/css');
8
- var loaders = require('next/dist/build/webpack/config/blocks/css/loaders');
8
+ var findPagesDir = require('next/dist/lib/find-pages-dir');
9
+ var nextMiniCssExtractPluginExports = require('next/dist/build/webpack/plugins/mini-css-extract-plugin');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
12
 
12
13
  var browserslist__default = /*#__PURE__*/_interopDefault(browserslist);
14
+ var nextMiniCssExtractPluginExports__default = /*#__PURE__*/_interopDefault(nextMiniCssExtractPluginExports);
13
15
 
16
+ // Next.js' built-in mini-css-extract-plugin has a very terrible type definition, let's just use any
17
+ const NextMiniCssExtractPlugin =
18
+ // @ts-expect-error -- Next.js' precompilation does add "__esModule: true", but doesn't add an actual default exports
19
+ nextMiniCssExtractPluginExports__default["default"].default;
14
20
  function getSupportedBrowsers(dir, isDevelopment) {
15
21
  let browsers;
16
22
  try {
@@ -21,33 +27,108 @@ function getSupportedBrowsers(dir, isDevelopment) {
21
27
  } catch {}
22
28
  return browsers;
23
29
  }
30
+ // https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L7
31
+ const getVanillaExtractCssLoaders = (options, assetPrefix) => {
32
+ const loaders = [];
33
+
34
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L14
35
+ if (!options.isServer) {
36
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/client.ts#L44
37
+ // next-style-loader will mess up css order in development mode.
38
+ // Next.js appDir doesn't use next-style-loader either.
39
+ // So we always use css-loader here, to simplify things and get proper order of output CSS
40
+ loaders.push({
41
+ loader: NextMiniCssExtractPlugin.loader,
42
+ options: {
43
+ publicPath: `${assetPrefix}/_next/`,
44
+ esModule: false
45
+ }
46
+ });
47
+ }
48
+ const postcss = () => css.lazyPostCSS(options.dir, getSupportedBrowsers(options.dir, options.dev), undefined);
49
+
50
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L28
51
+ loaders.push({
52
+ loader: require.resolve('next/dist/build/webpack/loaders/css-loader/src'),
53
+ options: {
54
+ postcss,
55
+ importLoaders: 1,
56
+ modules: false
57
+ }
58
+ });
59
+
60
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L43
61
+ loaders.push({
62
+ loader: require.resolve('next/dist/build/webpack/loaders/postcss-loader/src'),
63
+ options: {
64
+ postcss
65
+ }
66
+ });
67
+ return loaders;
68
+ };
24
69
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
25
70
  webpack(config, options) {
26
- var _nextConfig$experimen;
71
+ var _resolvedNextConfig$e, _resolvedNextConfig$e2;
27
72
  const {
28
73
  dir,
29
74
  dev,
30
- isServer
75
+ isServer,
76
+ config: resolvedNextConfig
31
77
  } = options;
78
+ const findPagesDirResult = findPagesDir.findPagesDir(dir, (_resolvedNextConfig$e = resolvedNextConfig.experimental) === null || _resolvedNextConfig$e === void 0 ? void 0 : _resolvedNextConfig$e.appDir);
79
+
80
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/index.ts#L336
81
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/webpack-config.ts#L626
82
+ // https://github.com/vercel/next.js/pull/43916
83
+ const hasAppDir =
84
+ // on Next.js 12, findPagesDirResult is a string. on Next.js 13, findPagesDirResult is an object
85
+ !!((_resolvedNextConfig$e2 = resolvedNextConfig.experimental) !== null && _resolvedNextConfig$e2 !== void 0 && _resolvedNextConfig$e2.appDir) && !!(findPagesDirResult && findPagesDirResult.appDir);
86
+ const outputCss = hasAppDir ?
87
+ // Always output css since Next.js App Router needs to collect Server CSS from React Server Components
88
+ true :
89
+ // There is no appDir, do not output css on server build
90
+ !isServer;
32
91
  const cssRules = config.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
33
92
  test
34
93
  }) => typeof test === 'object' && typeof test.test === 'function' && test.test('filename.css'))).oneOf;
35
94
  cssRules.unshift({
36
95
  test: /\.vanilla\.css$/i,
37
96
  sideEffects: true,
38
- use: loaders.getGlobalCssLoader({
39
- assetPrefix: config.assetPrefix,
40
- isClient: !isServer,
41
- isServer,
42
- isDevelopment: dev,
43
- future: nextConfig.future || {},
44
- experimental: nextConfig.experimental || {},
45
- // @ts-ignore -- 'appDir' config is in beta
46
- hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
47
- }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
97
+ use: getVanillaExtractCssLoaders(options, resolvedNextConfig.assetPrefix)
48
98
  });
99
+
100
+ // vanilla-extract need to emit the css file on both server and client, both during the
101
+ // development and production.
102
+ // However, Next.js only add MiniCssExtractPlugin on pages dir + client build + production mode.
103
+ //
104
+ // To simplify the logic at our side, we will add MiniCssExtractPlugin based on
105
+ // the "instanceof" check (We will only add our required MiniCssExtractPlugin if
106
+ // Next.js hasn't added it yet).
107
+ // This also prevent multiple MiniCssExtractPlugin being added (which will cause
108
+ // RealContentHashPlugin to panic)
109
+ if (!config.plugins.some(plugin => plugin instanceof NextMiniCssExtractPlugin)) {
110
+ // HMR reloads the CSS file when the content changes but does not use
111
+ // the new file name, which means it can't contain a hash.
112
+ const filename = dev ? 'static/css/[name].css' : 'static/css/[contenthash].css';
113
+ config.plugins.push(new NextMiniCssExtractPlugin({
114
+ filename,
115
+ chunkFilename: filename,
116
+ // Next.js guarantees that CSS order "doesn't matter", due to imposed
117
+ // restrictions:
118
+ // 1. Global CSS can only be defined in a single entrypoint (_app)
119
+ // 2. CSS Modules generate scoped class names by default and cannot
120
+ // include Global CSS (:global() selector).
121
+ //
122
+ // While not a perfect guarantee (e.g. liberal use of `:global()`
123
+ // selector), this assumption is required to code-split CSS.
124
+ //
125
+ // If this warning were to trigger, it'd be unactionable by the user,
126
+ // but likely not valid -- so just disable it.
127
+ ignoreOrder: true
128
+ }));
129
+ }
49
130
  config.plugins.push(new webpackPlugin.VanillaExtractPlugin({
50
- outputCss: !isServer,
131
+ outputCss,
51
132
  ...pluginOptions
52
133
  }));
53
134
  if (typeof nextConfig.webpack === 'function') {
@@ -1,8 +1,13 @@
1
1
  import { VanillaExtractPlugin } from '@vanilla-extract/webpack-plugin';
2
2
  import browserslist from 'browserslist';
3
3
  import { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css';
4
- import { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders';
4
+ import { findPagesDir } from 'next/dist/lib/find-pages-dir';
5
+ import nextMiniCssExtractPluginExports from 'next/dist/build/webpack/plugins/mini-css-extract-plugin';
5
6
 
7
+ // Next.js' built-in mini-css-extract-plugin has a very terrible type definition, let's just use any
8
+ const NextMiniCssExtractPlugin =
9
+ // @ts-expect-error -- Next.js' precompilation does add "__esModule: true", but doesn't add an actual default exports
10
+ nextMiniCssExtractPluginExports.default;
6
11
  function getSupportedBrowsers(dir, isDevelopment) {
7
12
  let browsers;
8
13
  try {
@@ -13,33 +18,108 @@ function getSupportedBrowsers(dir, isDevelopment) {
13
18
  } catch {}
14
19
  return browsers;
15
20
  }
21
+ // https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L7
22
+ const getVanillaExtractCssLoaders = (options, assetPrefix) => {
23
+ const loaders = [];
24
+
25
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L14
26
+ if (!options.isServer) {
27
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/client.ts#L44
28
+ // next-style-loader will mess up css order in development mode.
29
+ // Next.js appDir doesn't use next-style-loader either.
30
+ // So we always use css-loader here, to simplify things and get proper order of output CSS
31
+ loaders.push({
32
+ loader: NextMiniCssExtractPlugin.loader,
33
+ options: {
34
+ publicPath: `${assetPrefix}/_next/`,
35
+ esModule: false
36
+ }
37
+ });
38
+ }
39
+ const postcss = () => lazyPostCSS(options.dir, getSupportedBrowsers(options.dir, options.dev), undefined);
40
+
41
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L28
42
+ loaders.push({
43
+ loader: require.resolve('next/dist/build/webpack/loaders/css-loader/src'),
44
+ options: {
45
+ postcss,
46
+ importLoaders: 1,
47
+ modules: false
48
+ }
49
+ });
50
+
51
+ // https://github.com/vercel/next.js/blob/a4f2bbbe2047d4ed88e9b6f32f6b0adfc8d0c46a/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L43
52
+ loaders.push({
53
+ loader: require.resolve('next/dist/build/webpack/loaders/postcss-loader/src'),
54
+ options: {
55
+ postcss
56
+ }
57
+ });
58
+ return loaders;
59
+ };
16
60
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
17
61
  webpack(config, options) {
18
- var _nextConfig$experimen;
62
+ var _resolvedNextConfig$e, _resolvedNextConfig$e2;
19
63
  const {
20
64
  dir,
21
65
  dev,
22
- isServer
66
+ isServer,
67
+ config: resolvedNextConfig
23
68
  } = options;
69
+ const findPagesDirResult = findPagesDir(dir, (_resolvedNextConfig$e = resolvedNextConfig.experimental) === null || _resolvedNextConfig$e === void 0 ? void 0 : _resolvedNextConfig$e.appDir);
70
+
71
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/index.ts#L336
72
+ // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/webpack-config.ts#L626
73
+ // https://github.com/vercel/next.js/pull/43916
74
+ const hasAppDir =
75
+ // on Next.js 12, findPagesDirResult is a string. on Next.js 13, findPagesDirResult is an object
76
+ !!((_resolvedNextConfig$e2 = resolvedNextConfig.experimental) !== null && _resolvedNextConfig$e2 !== void 0 && _resolvedNextConfig$e2.appDir) && !!(findPagesDirResult && findPagesDirResult.appDir);
77
+ const outputCss = hasAppDir ?
78
+ // Always output css since Next.js App Router needs to collect Server CSS from React Server Components
79
+ true :
80
+ // There is no appDir, do not output css on server build
81
+ !isServer;
24
82
  const cssRules = config.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
25
83
  test
26
84
  }) => typeof test === 'object' && typeof test.test === 'function' && test.test('filename.css'))).oneOf;
27
85
  cssRules.unshift({
28
86
  test: /\.vanilla\.css$/i,
29
87
  sideEffects: true,
30
- use: getGlobalCssLoader({
31
- assetPrefix: config.assetPrefix,
32
- isClient: !isServer,
33
- isServer,
34
- isDevelopment: dev,
35
- future: nextConfig.future || {},
36
- experimental: nextConfig.experimental || {},
37
- // @ts-ignore -- 'appDir' config is in beta
38
- hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
39
- }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
88
+ use: getVanillaExtractCssLoaders(options, resolvedNextConfig.assetPrefix)
40
89
  });
90
+
91
+ // vanilla-extract need to emit the css file on both server and client, both during the
92
+ // development and production.
93
+ // However, Next.js only add MiniCssExtractPlugin on pages dir + client build + production mode.
94
+ //
95
+ // To simplify the logic at our side, we will add MiniCssExtractPlugin based on
96
+ // the "instanceof" check (We will only add our required MiniCssExtractPlugin if
97
+ // Next.js hasn't added it yet).
98
+ // This also prevent multiple MiniCssExtractPlugin being added (which will cause
99
+ // RealContentHashPlugin to panic)
100
+ if (!config.plugins.some(plugin => plugin instanceof NextMiniCssExtractPlugin)) {
101
+ // HMR reloads the CSS file when the content changes but does not use
102
+ // the new file name, which means it can't contain a hash.
103
+ const filename = dev ? 'static/css/[name].css' : 'static/css/[contenthash].css';
104
+ config.plugins.push(new NextMiniCssExtractPlugin({
105
+ filename,
106
+ chunkFilename: filename,
107
+ // Next.js guarantees that CSS order "doesn't matter", due to imposed
108
+ // restrictions:
109
+ // 1. Global CSS can only be defined in a single entrypoint (_app)
110
+ // 2. CSS Modules generate scoped class names by default and cannot
111
+ // include Global CSS (:global() selector).
112
+ //
113
+ // While not a perfect guarantee (e.g. liberal use of `:global()`
114
+ // selector), this assumption is required to code-split CSS.
115
+ //
116
+ // If this warning were to trigger, it'd be unactionable by the user,
117
+ // but likely not valid -- so just disable it.
118
+ ignoreOrder: true
119
+ }));
120
+ }
41
121
  config.plugins.push(new VanillaExtractPlugin({
42
- outputCss: !isServer,
122
+ outputCss,
43
123
  ...pluginOptions
44
124
  }));
45
125
  if (typeof nextConfig.webpack === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/next-plugin",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Zero-runtime Stylesheets-in-TypeScript",
5
5
  "main": "dist/vanilla-extract-next-plugin.cjs.js",
6
6
  "module": "dist/vanilla-extract-next-plugin.esm.js",
@@ -19,9 +19,10 @@
19
19
  "browserslist": "^4.19.1"
20
20
  },
21
21
  "peerDependencies": {
22
- "next": ">=12.0.5"
22
+ "next": ">=12.1.7"
23
23
  },
24
24
  "devDependencies": {
25
- "next": "^12.0.5"
25
+ "next": "12.3.4",
26
+ "webpack": "^5.36.1"
26
27
  }
27
28
  }