Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,13 @@ export default async function loadConfig(
throw err
}

const userConfig = (await normalizeConfig(
phase,
userConfigModule.default || userConfigModule
)) as NextConfig
// Clone a new userConfig each time to avoid mutating the original
const userConfig = {
...(await normalizeConfig(
Comment thread
ijjk marked this conversation as resolved.
Resolved
phase,
userConfigModule.default || userConfigModule
)),
} as NextConfig

if (!process.env.NEXT_MINIMAL) {
// We only validate the config against schema in non minimal mode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { nextTestSetup } from 'e2e-utils'

describe('app-dir - metadata-streaming-customized-rule', () => {
const { next } = nextTestSetup({
const { next, isNextDev } = nextTestSetup({
files: __dirname,
overrideFiles: {
'next.config.js': `
Expand Down Expand Up @@ -39,4 +39,12 @@ describe('app-dir - metadata-streaming-customized-rule', () => {
expect(await $('head title').length).toBe(0)
expect(await $('body title').length).toBe(1)
})

if (isNextDev) {
it('should not have schema issue', () => {
expect(next.cliOutput).not.toContain(
'Invalid next.config.js options detected'
)
})
}
})