Skip to content

Commit

Permalink
fix(nextjs): check validity of Nx context in withNx plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored and Jack Hsu committed Nov 23, 2022
1 parent a2cf352 commit e00d323
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/next/plugins/with-nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export function withNx(
nextConfig = {} as WithNxOptions,
context: WithNxContext = getWithNxContext()
): NextConfig {
// If `next-compose-plugins` is used, the context argument is invalid.
if (!context.libsDir || !context.workspaceRoot) {
context = getWithNxContext();
}
const userWebpack = nextConfig.webpack || ((x) => x);
const { nx, ...validNextConfig } = nextConfig;
return {
Expand Down

0 comments on commit e00d323

Please sign in to comment.