Skip to content

Commit

Permalink
Use the resolved Next.js config in next-plugin (#1099)
Browse files Browse the repository at this point in the history
* use resolved next.js config instead

* add changeset
  • Loading branch information
shuding committed May 26, 2023
1 parent 00012e4 commit 0d1c17a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-crews-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vanilla-extract/next-plugin": patch
---

Use the resolved Next.js config in `next-plugin`
8 changes: 4 additions & 4 deletions packages/next-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const createVanillaExtractPlugin =
(nextConfig: NextConfig = {}): NextConfig =>
Object.assign({}, nextConfig, {
webpack(config: any, options: any) {
const { dir, dev, isServer } = options;
const { dir, dev, isServer, config: resolvedNextConfig } = options;

const cssRules = config.module.rules.find(
(rule: any) =>
Expand All @@ -45,10 +45,10 @@ export const createVanillaExtractPlugin =
isClient: !isServer,
isServer,
isDevelopment: dev,
future: nextConfig.future || {},
experimental: nextConfig.experimental || {},
future: resolvedNextConfig.future || {},
experimental: resolvedNextConfig.experimental || {},
// @ts-ignore -- 'appDir' config is in beta
hasAppDir: nextConfig.experimental?.appDir,
hasAppDir: resolvedNextConfig.experimental?.appDir,
} as any,
() => lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined),
[],
Expand Down

0 comments on commit 0d1c17a

Please sign in to comment.