Skip to content

Commit 25a9547

Browse files
timneutkensijjk
andauthored
Remove experimental config from create-next-app (#49241)
## What? Removes `experimental.appDir` this was leftover from when I flipped the switch. Kept the config file as in the future we might add future flags and such. It also helps that it has the types comment included so you always get types. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation or adding/fixing Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
1 parent c881224 commit 25a9547

File tree

99 files changed

+78
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+78
-344
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
experimental: {
4-
appDir: true,
5-
},
6-
}
2+
const nextConfig = {}
73

84
module.exports = nextConfig
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
experimental: {
4-
appDir: true,
5-
},
6-
}
2+
const nextConfig = {}
73

84
module.exports = nextConfig
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
experimental: {
4-
appDir: true,
5-
},
6-
}
2+
const nextConfig = {}
73

84
module.exports = nextConfig
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
experimental: {
4-
appDir: true,
5-
},
6-
}
2+
const nextConfig = {}
73

84
module.exports = nextConfig

packages/next/src/cli/next-dev.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import isError from '../lib/is-error'
88
import { getProjectDir } from '../lib/get-project-dir'
99
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'
1010
import path from 'path'
11-
import type { NextConfig, NextConfigComplete } from '../server/config-shared'
11+
import {
12+
defaultConfig,
13+
NextConfig,
14+
NextConfigComplete,
15+
} from '../server/config-shared'
1216
import { traceGlobals } from '../trace/shared'
1317
import { Telemetry } from '../telemetry/storage'
1418
import loadConfig from '../server/config'
@@ -239,7 +243,9 @@ const nextDev: CliCommand = async (argv) => {
239243
const distDir = path.join(dir, rawNextConfig.distDir || '.next')
240244
const { pagesDir, appDir } = findPagesDir(
241245
dir,
242-
!!rawNextConfig.experimental?.appDir
246+
typeof rawNextConfig?.experimental?.appDir === 'undefined'
247+
? !!defaultConfig.experimental?.appDir
248+
: !!rawNextConfig.experimental?.appDir
243249
)
244250
const telemetry = new Telemetry({
245251
distDir,

packages/next/src/lib/turbopack-warning.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export async function validateTurboNextConfig({
120120
let keys: string[] = []
121121

122122
for (const key in obj) {
123-
if (typeof obj[key] === 'undefined') {
123+
if (typeof obj?.[key] === 'undefined') {
124124
continue
125125
}
126126

@@ -145,9 +145,9 @@ export async function validateTurboNextConfig({
145145
keys = keys.split('.')
146146
}
147147
if (keys.length === 1) {
148-
return obj[keys[0]]
148+
return obj?.[keys?.[0]]
149149
}
150-
return getDeepValue(obj[keys[0]], keys.slice(1))
150+
return getDeepValue(obj?.[keys?.[0]], keys.slice(1))
151151
}
152152

153153
const customKeys = flattenKeys(rawNextConfig)

packages/next/src/server/config.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,6 @@ function assignDefaults(
135135
for (const featureName of Object.keys(
136136
value
137137
) as (keyof ExperimentalConfig)[]) {
138-
const featureValue = value[featureName]
139-
if (featureName === 'appDir' && featureValue === true) {
140-
// auto enable clientRouterFilter if not manually set
141-
// when appDir is enabled
142-
if (
143-
typeof userConfig.experimental.clientRouterFilter ===
144-
'undefined'
145-
) {
146-
userConfig.experimental.clientRouterFilter = true
147-
}
148-
}
149138
if (
150139
value[featureName] !== defaultConfig.experimental[featureName]
151140
) {
@@ -456,6 +445,13 @@ function assignDefaults(
456445
silent
457446
)
458447

448+
if (
449+
typeof userConfig.experimental?.clientRouterFilter === 'undefined' &&
450+
result.experimental?.appDir
451+
) {
452+
result.experimental.clientRouterFilter = true
453+
}
454+
459455
if (
460456
result.experimental?.outputFileTracingRoot &&
461457
!isAbsolute(result.experimental.outputFileTracingRoot)

test/.stats-app/next.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
62

73
// For development: analyze the bundled chunks for stats app
84
if (process.env.ANALYZE) {

test/development/acceptance-app/fixtures/app-hmr-changes/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const withMDX = require('@next/mdx')()
33
module.exports = withMDX({
44
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
55
experimental: {
6-
appDir: true,
76
mdxRs: true,
87
},
98
images: {
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
module.exports = {
2-
experimental: { appDir: true },
3-
}
1+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
22
* @type {import('next').NextConfig}
33
*/
4-
const nextConfig = {
5-
experimental: { appDir: true },
6-
}
4+
const nextConfig = {}
75

86
module.exports = nextConfig
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/**
22
* @type {import('next').NextConfig}
33
*/
4-
module.exports = {
5-
experimental: {
6-
appDir: true,
7-
},
8-
}
4+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
module.exports = {
2-
experimental: { appDir: true },
3-
}
1+
module.exports = {}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
module.exports = {
2-
experimental: { appDir: true },
3-
}
1+
module.exports = {}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
22
* @type {import('next').NextConfig}
33
*/
4-
const nextConfig = {
5-
experimental: { appDir: true },
6-
}
4+
const nextConfig = {}
75

86
module.exports = nextConfig
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
module.exports = {
33
experimental: {
4-
appDir: true,
54
serverActions: true,
65
},
76
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
export default {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
export default {}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module.exports = {
22
basePath: '/base',
3-
experimental: {
4-
appDir: true,
5-
},
63
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
const nextConfig = {
22
pageExtensions: ['page.jsx', 'page.js'],
3-
experimental: {
4-
appDir: true,
5-
},
63
}
74

85
module.exports = nextConfig

test/e2e/app-dir/app-css/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const withMDX = mdx()
55
const nextConfig = {
66
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
77
experimental: {
8-
appDir: true,
98
mdxRs: true,
109
},
1110
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}

test/e2e/app-dir/app-external/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module.exports = {
22
reactStrictMode: true,
33
transpilePackages: ['untranspiled-module', 'css', 'font'],
44
experimental: {
5-
appDir: true,
65
serverComponentsExternalPackages: ['conditional-exports-optout'],
76
},
87
}

test/e2e/app-dir/app-middleware/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
experimental: {
3-
appDir: true,
43
clientRouterFilter: true,
54
clientRouterFilterRedirects: true,
65
},
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}

test/e2e/app-dir/app-routes-trailing-slash/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
const nextConfig = {
55
trailingSlash: true,
6-
experimental: { appDir: true },
76
}
87

98
module.exports = nextConfig

test/e2e/app-dir/app-routes/next.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
* @type {import('next').NextConfig}
33
*/
44
module.exports = {
5-
experimental: {
6-
appDir: true,
7-
},
85
typescript: {
96
ignoreBuildErrors: true,
107
},

test/e2e/app-dir/app-static/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**@type import('next').NextConfig */
22
module.exports = {
33
experimental: {
4-
appDir: true,
54
incrementalCacheHandlerPath: process.env.CUSTOM_CACHE_HANDLER
65
? require.resolve('./cache-handler.js')
76
: undefined,
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}

test/e2e/app-dir/app/next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
experimental: {
3-
appDir: true,
43
clientRouterFilterRedirects: true,
54
sri: {
65
algorithm: 'sha256',

test/e2e/app-dir/asset-prefix/next.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
52
assetPrefix: '/assets',
63
rewrites() {
74
return {
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/** @type {import("next").NextConfig} */
22
module.exports = {
33
reactStrictMode: true,
4-
experimental: { appDir: true },
54
}

test/e2e/app-dir/back-button-download-bug/next.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
module.exports = {
33
reactStrictMode: true,
4-
experimental: {
5-
appDir: true,
6-
},
74
images: {
85
domains: ['res.cloudinary.com', 'avatars.githubusercontent.com'],
96
},

test/e2e/app-dir/create-next-app-template/next.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
33
})
44

55
/** @type {import('next').NextConfig} */
6-
const nextConfig = {
7-
experimental: {
8-
appDir: true,
9-
},
10-
}
6+
const nextConfig = {}
117

128
// module.exports = nextConfig
139
module.exports = withBundleAnalyzer(nextConfig)
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
22
* @type {import('next').NextConfig}
33
*/
4-
const nextConfig = {
5-
experimental: { appDir: true },
6-
}
4+
const nextConfig = {}
75

86
module.exports = nextConfig
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
experimental: {
3-
appDir: true,
4-
},
5-
}
1+
module.exports = {}

0 commit comments

Comments
 (0)