Unverified Commit 25a9547c authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

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: 's avatarJJ Kasper <jj@jjsweb.site>
parent c881224e
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: {
appDir: true,
},
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: {
appDir: true,
},
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: {
appDir: true,
},
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: {
appDir: true,
},
}
module.exports = nextConfig module.exports = nextConfig
...@@ -8,7 +8,11 @@ import isError from '../lib/is-error' ...@@ -8,7 +8,11 @@ import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir' import { getProjectDir } from '../lib/get-project-dir'
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants' import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'
import path from 'path' 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 { traceGlobals } from '../trace/shared'
import { Telemetry } from '../telemetry/storage' import { Telemetry } from '../telemetry/storage'
import loadConfig from '../server/config' import loadConfig from '../server/config'
...@@ -239,7 +243,9 @@ const nextDev: CliCommand = async (argv) => { ...@@ -239,7 +243,9 @@ const nextDev: CliCommand = async (argv) => {
const distDir = path.join(dir, rawNextConfig.distDir || '.next') const distDir = path.join(dir, rawNextConfig.distDir || '.next')
const { pagesDir, appDir } = findPagesDir( const { pagesDir, appDir } = findPagesDir(
dir, dir,
!!rawNextConfig.experimental?.appDir typeof rawNextConfig?.experimental?.appDir === 'undefined'
? !!defaultConfig.experimental?.appDir
: !!rawNextConfig.experimental?.appDir
) )
const telemetry = new Telemetry({ const telemetry = new Telemetry({
distDir, distDir,
......
...@@ -120,7 +120,7 @@ export async function validateTurboNextConfig({ ...@@ -120,7 +120,7 @@ export async function validateTurboNextConfig({
let keys: string[] = [] let keys: string[] = []
for (const key in obj) { for (const key in obj) {
if (typeof obj[key] === 'undefined') { if (typeof obj?.[key] === 'undefined') {
continue continue
} }
...@@ -145,9 +145,9 @@ export async function validateTurboNextConfig({ ...@@ -145,9 +145,9 @@ export async function validateTurboNextConfig({
keys = keys.split('.') keys = keys.split('.')
} }
if (keys.length === 1) { 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) const customKeys = flattenKeys(rawNextConfig)
......
...@@ -135,17 +135,6 @@ function assignDefaults( ...@@ -135,17 +135,6 @@ function assignDefaults(
for (const featureName of Object.keys( for (const featureName of Object.keys(
value value
) as (keyof ExperimentalConfig)[]) { ) as (keyof ExperimentalConfig)[]) {
const featureValue = value[featureName]
if (featureName === 'appDir' && featureValue === true) {
// auto enable clientRouterFilter if not manually set
// when appDir is enabled
if (
typeof userConfig.experimental.clientRouterFilter ===
'undefined'
) {
userConfig.experimental.clientRouterFilter = true
}
}
if ( if (
value[featureName] !== defaultConfig.experimental[featureName] value[featureName] !== defaultConfig.experimental[featureName]
) { ) {
...@@ -456,6 +445,13 @@ function assignDefaults( ...@@ -456,6 +445,13 @@ function assignDefaults(
silent silent
) )
if (
typeof userConfig.experimental?.clientRouterFilter === 'undefined' &&
result.experimental?.appDir
) {
result.experimental.clientRouterFilter = true
}
if ( if (
result.experimental?.outputFileTracingRoot && result.experimental?.outputFileTracingRoot &&
!isAbsolute(result.experimental.outputFileTracingRoot) !isAbsolute(result.experimental.outputFileTracingRoot)
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
// For development: analyze the bundled chunks for stats app // For development: analyze the bundled chunks for stats app
if (process.env.ANALYZE) { if (process.env.ANALYZE) {
......
...@@ -3,7 +3,6 @@ const withMDX = require('@next/mdx')() ...@@ -3,7 +3,6 @@ const withMDX = require('@next/mdx')()
module.exports = withMDX({ module.exports = withMDX({
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: { experimental: {
appDir: true,
mdxRs: true, mdxRs: true,
}, },
images: { images: {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: { appDir: true },
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { module.exports = {
experimental: { experimental: {
appDir: true,
serverActions: true, serverActions: true,
}, },
} }
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
export default { export default {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
basePath: '/base', basePath: '/base',
experimental: {
appDir: true,
},
} }
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
const nextConfig = { const nextConfig = {
pageExtensions: ['page.jsx', 'page.js'], pageExtensions: ['page.jsx', 'page.js'],
experimental: {
appDir: true,
},
} }
module.exports = nextConfig module.exports = nextConfig
...@@ -5,7 +5,6 @@ const withMDX = mdx() ...@@ -5,7 +5,6 @@ const withMDX = mdx()
const nextConfig = { const nextConfig = {
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: { experimental: {
appDir: true,
mdxRs: true, mdxRs: true,
}, },
} }
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
...@@ -2,7 +2,6 @@ module.exports = { ...@@ -2,7 +2,6 @@ module.exports = {
reactStrictMode: true, reactStrictMode: true,
transpilePackages: ['untranspiled-module', 'css', 'font'], transpilePackages: ['untranspiled-module', 'css', 'font'],
experimental: { experimental: {
appDir: true,
serverComponentsExternalPackages: ['conditional-exports-optout'], serverComponentsExternalPackages: ['conditional-exports-optout'],
}, },
} }
module.exports = { module.exports = {
experimental: { experimental: {
appDir: true,
clientRouterFilter: true, clientRouterFilter: true,
clientRouterFilterRedirects: true, clientRouterFilterRedirects: true,
}, },
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
*/ */
const nextConfig = { const nextConfig = {
trailingSlash: true, trailingSlash: true,
experimental: { appDir: true },
} }
module.exports = nextConfig module.exports = nextConfig
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
module.exports = { module.exports = {
experimental: {
appDir: true,
},
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
......
/**@type import('next').NextConfig */ /**@type import('next').NextConfig */
module.exports = { module.exports = {
experimental: { experimental: {
appDir: true,
incrementalCacheHandlerPath: process.env.CUSTOM_CACHE_HANDLER incrementalCacheHandlerPath: process.env.CUSTOM_CACHE_HANDLER
? require.resolve('./cache-handler.js') ? require.resolve('./cache-handler.js')
: undefined, : undefined,
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
experimental: { experimental: {
appDir: true,
clientRouterFilterRedirects: true, clientRouterFilterRedirects: true,
sri: { sri: {
algorithm: 'sha256', algorithm: 'sha256',
......
module.exports = { module.exports = {
experimental: {
appDir: true,
},
assetPrefix: '/assets', assetPrefix: '/assets',
rewrites() { rewrites() {
return { return {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: { appDir: true },
} }
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
appDir: true,
},
images: { images: {
domains: ['res.cloudinary.com', 'avatars.githubusercontent.com'], domains: ['res.cloudinary.com', 'avatars.githubusercontent.com'],
}, },
......
...@@ -3,11 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({ ...@@ -3,11 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
}) })
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: {
appDir: true,
},
}
// module.exports = nextConfig // module.exports = nextConfig
module.exports = withBundleAnalyzer(nextConfig) module.exports = withBundleAnalyzer(nextConfig)
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
appDir: true,
},
} }
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
experimental: {
appDir: true,
},
rewrites() { rewrites() {
return { return {
fallback: [ fallback: [
......
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {
experimental: {
appDir: true,
},
rewrites: async () => { rewrites: async () => {
return { return {
afterFiles: [ afterFiles: [
......
...@@ -3,7 +3,4 @@ module.exports = { ...@@ -3,7 +3,4 @@ module.exports = {
defaultLocale: 'en-CA', defaultLocale: 'en-CA',
locales: ['en-CA', 'en-US', 'fr-CA', 'fr-FR'], locales: ['en-CA', 'en-US', 'fr-CA', 'fr-FR'],
}, },
experimental: {
appDir: true,
},
} }
module.exports = { module.exports = {
strictMode: true, strictMode: true,
experimental: {
appDir: true,
},
} }
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
...@@ -8,7 +8,6 @@ const withMDX = require('@next/mdx')({ ...@@ -8,7 +8,6 @@ const withMDX = require('@next/mdx')({
const nextConfig = { const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'], pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
experimental: { experimental: {
appDir: true,
mdxRs: process.env.WITH_MDX_RS === 'true', mdxRs: process.env.WITH_MDX_RS === 'true',
}, },
} }
......
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {
experimental: {
appDir: true,
},
redirects: () => { redirects: () => {
return [ return [
{ {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
*/ */
const nextConfig = { const nextConfig = {
pageExtensions: ['tsx', 'ts'], pageExtensions: ['tsx', 'ts'],
experimental: { appDir: true },
} }
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
appDir: true,
},
async rewrites() { async rewrites() {
return [ return [
{ {
......
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {
strictMode: true, strictMode: true,
experimental: {
appDir: true,
},
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
*/ */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
experimental: { appDir: true },
} }
module.exports = nextConfig module.exports = nextConfig
...@@ -4,7 +4,6 @@ module.exports = { ...@@ -4,7 +4,6 @@ module.exports = {
maxInactiveAge: 1000 * 60 * 60, maxInactiveAge: 1000 * 60 * 60,
}, },
experimental: { experimental: {
appDir: true,
serverComponentsExternalPackages: ['conditional-exports-optout'], serverComponentsExternalPackages: ['conditional-exports-optout'],
}, },
rewrites: async () => { rewrites: async () => {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
...@@ -9,7 +9,6 @@ const headers = nextConfigHeaders.map((header) => ({ ...@@ -9,7 +9,6 @@ const headers = nextConfigHeaders.map((header) => ({
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const config = { const config = {
experimental: { appDir: true },
async headers() { async headers() {
return [ return [
{ {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
experimental: {
appDir: true,
},
trailingSlash: true, trailingSlash: true,
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {
experimental: { appDir: true },
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
......
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { module.exports = {
output: 'standalone', output: 'standalone',
experimental: {
appDir: true,
},
} }
module.exports = { module.exports = {
experimental: { experimental: {
instrumentationHook: true, instrumentationHook: true,
appDir: true,
}, },
} }
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
appDir: true,
},
async rewrites() { async rewrites() {
return { return {
afterFiles: [ afterFiles: [
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
const nextConfig = { const nextConfig = {
output: 'export', output: 'export',
trailingSlash: true, trailingSlash: true,
experimental: {
appDir: true,
},
generateBuildId() { generateBuildId() {
return 'test-build-id' return 'test-build-id'
}, },
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
export default { export default {
experimental: { experimental: {
appDir: true,
typedRoutes: true, typedRoutes: true,
}, },
async rewrites() { async rewrites() {
......
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
experimental: {
appDir: true,
},
distDir: '.build', distDir: '.build',
} }
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const nextConfig = { const nextConfig = {}
experimental: { appDir: true },
}
module.exports = nextConfig module.exports = nextConfig
module.exports = { module.exports = {}
experimental: { appDir: true },
}
module.exports = { module.exports = {}
experimental: {
appDir: true,
},
}
module.exports = { module.exports = {
output: 'standalone', output: 'standalone',
experimental: {
appDir: true,
},
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment