Skip to content

Commit 0d1c17a

Browse files
authored
Use the resolved Next.js config in next-plugin (#1099)
* use resolved next.js config instead * add changeset
1 parent 00012e4 commit 0d1c17a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/shiny-crews-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vanilla-extract/next-plugin": patch
3+
---
4+
5+
Use the resolved Next.js config in `next-plugin`

packages/next-plugin/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const createVanillaExtractPlugin =
2323
(nextConfig: NextConfig = {}): NextConfig =>
2424
Object.assign({}, nextConfig, {
2525
webpack(config: any, options: any) {
26-
const { dir, dev, isServer } = options;
26+
const { dir, dev, isServer, config: resolvedNextConfig } = options;
2727

2828
const cssRules = config.module.rules.find(
2929
(rule: any) =>
@@ -45,10 +45,10 @@ export const createVanillaExtractPlugin =
4545
isClient: !isServer,
4646
isServer,
4747
isDevelopment: dev,
48-
future: nextConfig.future || {},
49-
experimental: nextConfig.experimental || {},
48+
future: resolvedNextConfig.future || {},
49+
experimental: resolvedNextConfig.experimental || {},
5050
// @ts-ignore -- 'appDir' config is in beta
51-
hasAppDir: nextConfig.experimental?.appDir,
51+
hasAppDir: resolvedNextConfig.experimental?.appDir,
5252
} as any,
5353
() => lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined),
5454
[],

0 commit comments

Comments
 (0)