Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove experimental config from create-next-app #49241

Merged
merged 5 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
const nextConfig = {}

module.exports = nextConfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
const nextConfig = {}

module.exports = nextConfig
6 changes: 1 addition & 5 deletions packages/create-next-app/templates/app/js/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
const nextConfig = {}

module.exports = nextConfig
6 changes: 1 addition & 5 deletions packages/create-next-app/templates/app/ts/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
const nextConfig = {}

module.exports = nextConfig
10 changes: 8 additions & 2 deletions packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'
import path from 'path'
import type { NextConfig, NextConfigComplete } from '../server/config-shared'
import {
defaultConfig,
NextConfig,
NextConfigComplete,
} from '../server/config-shared'
import { traceGlobals } from '../trace/shared'
import { Telemetry } from '../telemetry/storage'
import loadConfig from '../server/config'
Expand Down Expand Up @@ -239,7 +243,9 @@ const nextDev: CliCommand = async (argv) => {
const distDir = path.join(dir, rawNextConfig.distDir || '.next')
const { pagesDir, appDir } = findPagesDir(
dir,
!!rawNextConfig.experimental?.appDir
typeof rawNextConfig?.experimental?.appDir === 'undefined'
? !!defaultConfig.experimental?.appDir
: !!rawNextConfig.experimental?.appDir
)
const telemetry = new Telemetry({
distDir,
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/lib/turbopack-warning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export async function validateTurboNextConfig({
let keys: string[] = []

for (const key in obj) {
if (typeof obj[key] === 'undefined') {
if (typeof obj?.[key] === 'undefined') {
continue
}

Expand All @@ -145,9 +145,9 @@ export async function validateTurboNextConfig({
keys = keys.split('.')
}
if (keys.length === 1) {
return obj[keys[0]]
return obj?.[keys?.[0]]
}
return getDeepValue(obj[keys[0]], keys.slice(1))
return getDeepValue(obj?.[keys?.[0]], keys.slice(1))
}

const customKeys = flattenKeys(rawNextConfig)
Expand Down
6 changes: 1 addition & 5 deletions test/.stats-app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}

// For development: analyze the bundled chunks for stats app
if (process.env.ANALYZE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const withMDX = require('@next/mdx')()
module.exports = withMDX({
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: {
appDir: true,
mdxRs: true,
},
images: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
experimental: { appDir: true },
}
module.exports = {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: { appDir: true },
}
const nextConfig = {}

module.exports = nextConfig
6 changes: 1 addition & 5 deletions test/development/app-hmr/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/**
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
4 changes: 1 addition & 3 deletions test/development/app-render-error-log/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
experimental: { appDir: true },
}
module.exports = {}
6 changes: 1 addition & 5 deletions test/development/basic/node-builtins/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
4 changes: 1 addition & 3 deletions test/development/next-font/build-errors/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
experimental: { appDir: true },
}
module.exports = {}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: { appDir: true },
}
const nextConfig = {}

module.exports = nextConfig
1 change: 0 additions & 1 deletion test/e2e/app-dir/actions/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
appDir: true,
serverActions: true,
},
}
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-a11y/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-alias/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export default {
experimental: {
appDir: true,
},
}
export default {}
3 changes: 0 additions & 3 deletions test/e2e/app-dir/app-basepath/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
basePath: '/base',
experimental: {
appDir: true,
},
}
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-client-cache/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
3 changes: 0 additions & 3 deletions test/e2e/app-dir/app-css-pageextensions/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const nextConfig = {
pageExtensions: ['page.jsx', 'page.js'],
experimental: {
appDir: true,
},
}

module.exports = nextConfig
1 change: 0 additions & 1 deletion test/e2e/app-dir/app-css/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const withMDX = mdx()
const nextConfig = {
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: {
appDir: true,
mdxRs: true,
},
}
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-edge/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
1 change: 0 additions & 1 deletion test/e2e/app-dir/app-external/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
reactStrictMode: true,
transpilePackages: ['untranspiled-module', 'css', 'font'],
experimental: {
appDir: true,
serverComponentsExternalPackages: ['conditional-exports-optout'],
},
}
1 change: 0 additions & 1 deletion test/e2e/app-dir/app-middleware/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
experimental: {
appDir: true,
clientRouterFilter: true,
clientRouterFilterRedirects: true,
},
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-prefetch/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-rendering/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
const nextConfig = {
trailingSlash: true,
experimental: { appDir: true },
}

module.exports = nextConfig
3 changes: 0 additions & 3 deletions test/e2e/app-dir/app-routes/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: {
appDir: true,
},
typescript: {
ignoreBuildErrors: true,
},
Expand Down
1 change: 0 additions & 1 deletion test/e2e/app-dir/app-static/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**@type import('next').NextConfig */
module.exports = {
experimental: {
appDir: true,
incrementalCacheHandlerPath: process.env.CUSTOM_CACHE_HANDLER
? require.resolve('./cache-handler.js')
: undefined,
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/app-dir/app-validation/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
1 change: 0 additions & 1 deletion test/e2e/app-dir/app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
experimental: {
appDir: true,
clientRouterFilterRedirects: true,
sri: {
algorithm: 'sha256',
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/app-dir/asset-prefix/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
module.exports = {
experimental: {
appDir: true,
},
assetPrefix: '/assets',
rewrites() {
return {
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/app-dir/async-component-preload/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @type {import("next").NextConfig} */
module.exports = {
reactStrictMode: true,
experimental: { appDir: true },
}
3 changes: 0 additions & 3 deletions test/e2e/app-dir/back-button-download-bug/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
experimental: {
appDir: true,
},
images: {
domains: ['res.cloudinary.com', 'avatars.githubusercontent.com'],
},
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/app-dir/create-next-app-template/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
})

/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
const nextConfig = {}

// module.exports = nextConfig
module.exports = withBundleAnalyzer(nextConfig)
6 changes: 1 addition & 5 deletions test/e2e/app-dir/create-root-layout/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
4 changes: 1 addition & 3 deletions test/e2e/app-dir/crypto-globally-available/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: { appDir: true },
}
const nextConfig = {}

module.exports = nextConfig
6 changes: 1 addition & 5 deletions test/e2e/app-dir/draft-mode/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
6 changes: 1 addition & 5 deletions test/e2e/app-dir/dynamic-href/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
module.exports = {
experimental: {
appDir: true,
},
}
module.exports = {}
3 changes: 0 additions & 3 deletions test/e2e/app-dir/dynamic/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
reactStrictMode: true,
experimental: {
appDir: true,
},
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: { appDir: true },
}
const nextConfig = {}

module.exports = nextConfig
3 changes: 0 additions & 3 deletions test/e2e/app-dir/front-redirect-issue/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
rewrites() {
return {
fallback: [
Expand Down