Unverified Commit 0b32ddc6 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove --turbopack and --webpack flags from create-next-app (#89706)

## What?

Remove the `--turbopack` and `--webpack` CLI flags from
`create-next-app`.

## Why?

Turbopack is now the default bundler in Next.js. The `--turbopack` flag
is redundant since it's already the default, and the `--webpack` flag is
no longer needed as a `create-next-app` option. The only alternative
bundler flag retained is `--rspack`.

## How?

- Removed `--turbopack` and `--webpack` option definitions from the CLI
in `packages/create-next-app/index.ts`
- Simplified bundler selection logic: defaults to Turbopack, with
`--rspack` as the only override
- Removed `--turbopack` documentation from
`packages/create-next-app/README.md`
- Removed all `--no-turbopack` flags from test invocations across all
create-next-app test files
- Removed `--webpack` test cases from app, pages, and app-api template
tests
parent d95b7bff
......@@ -59,10 +59,6 @@ Options:
Initialize inside a `src/` directory.
--turbopack
Enable Turbopack by default for development.
--import-alias <alias-to-configure>
Specify import alias to use (default "@/*").
......
......@@ -55,8 +55,6 @@ const program = new Command(packageJson.name)
.option('--biome', 'Initialize with Biome config.')
.option('--app', 'Initialize as an App Router project.')
.option('--src-dir', "Initialize inside a 'src/' directory.")
.option('--turbopack', 'Enable Turbopack as the bundler.')
.option('--webpack', 'Enable Webpack as the bundler.')
.option('--rspack', 'Enable Rspack as the bundler.')
.option(
'--import-alias <prefix/*>',
......@@ -590,13 +588,7 @@ async function run(): Promise<void> {
}
}
const bundler: Bundler = opts.turbopack
? Bundler.Turbopack
: opts.webpack
? Bundler.Webpack
: opts.rspack
? Bundler.Rspack
: Bundler.Turbopack
const bundler: Bundler = opts.rspack ? Bundler.Rspack : Bundler.Turbopack
try {
await createApp({
......
......@@ -29,7 +29,6 @@ describe('create-next-app Biome configuration', () => {
'--no-tailwind',
'--no-src-dir',
'--app',
'--no-turbopack',
'--no-import-alias',
'--no-react-compiler',
'--skip-install',
......@@ -58,7 +57,6 @@ describe('create-next-app Biome configuration', () => {
'--no-tailwind',
'--no-src-dir',
'--app',
'--no-turbopack',
'--no-import-alias',
'--no-react-compiler',
],
......@@ -95,7 +93,6 @@ describe('create-next-app Biome configuration', () => {
'--no-tailwind',
'--no-src-dir',
'--app',
'--no-turbopack',
'--no-import-alias',
'--no-react-compiler',
],
......@@ -132,7 +129,6 @@ describe('create-next-app Biome configuration', () => {
'--no-tailwind',
'--no-src-dir',
'--app',
'--no-turbopack',
'--no-import-alias',
'--no-react-compiler',
],
......@@ -169,7 +165,6 @@ describe('create-next-app Biome configuration', () => {
'--no-tailwind',
'--no-src-dir',
'--app',
'--no-turbopack',
'--no-import-alias',
'--no-react-compiler',
],
......
......@@ -30,7 +30,6 @@ describe('create-next-app ESLint configuration', () => {
'--no-src-dir',
'--no-react-compiler',
'--app',
'--no-turbopack',
'--no-import-alias',
'--skip-install',
],
......@@ -78,7 +77,6 @@ describe('create-next-app ESLint configuration', () => {
'--no-src-dir',
'--no-react-compiler',
'--app',
'--no-turbopack',
'--no-import-alias',
'--skip-install',
],
......
......@@ -34,7 +34,6 @@ describe('create-next-app', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-tailwind',
'--no-src-dir',
......@@ -77,7 +76,6 @@ describe('create-next-app', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--no-tailwind',
'--no-src-dir',
......@@ -109,7 +107,6 @@ describe('create-next-app', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-tailwind',
'--no-src-dir',
......
......@@ -44,7 +44,6 @@ describe('create-next-app with package manager bun', () => {
'--ts',
'--app',
'--use-bun',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -74,7 +73,6 @@ describe('create-next-app with package manager bun', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......
......@@ -33,7 +33,6 @@ describe('create-next-app with package manager npm', () => {
'--ts',
'--app',
'--use-npm',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -63,7 +62,6 @@ describe('create-next-app with package manager npm', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......
......@@ -34,7 +34,6 @@ describe('create-next-app with package manager pnpm', () => {
'--ts',
'--app',
'--use-pnpm',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -64,7 +63,6 @@ describe('create-next-app with package manager pnpm', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -99,7 +97,6 @@ describe('create-next-app with package manager pnpm', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -131,7 +128,6 @@ describe('create-next-app with package manager pnpm', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......
......@@ -41,7 +41,6 @@ describe('create-next-app with package manager yarn', () => {
'--ts',
'--app',
'--use-yarn',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......@@ -71,7 +70,6 @@ describe('create-next-app with package manager yarn', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--no-linter',
'--no-src-dir',
'--no-tailwind',
......
......@@ -25,7 +25,6 @@ describe('create-next-app prompts', () => {
'--ts',
'--app',
'--eslint',
'--no-turbopack',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
......@@ -65,7 +64,6 @@ describe('create-next-app prompts', () => {
projectName,
'--app',
'--eslint',
'--no-turbopack',
'--no-tailwind',
'--no-src-dir',
'--no-import-alias',
......@@ -103,7 +101,6 @@ describe('create-next-app prompts', () => {
'--ts',
'--app',
'--eslint',
'--no-turbopack',
'--no-src-dir',
'--no-import-alias',
'--no-react-compiler',
......@@ -140,7 +137,6 @@ describe('create-next-app prompts', () => {
'--ts',
'--app',
'--eslint',
'--no-turbopack',
'--no-tailwind',
'--no-src-dir',
'--no-react-compiler',
......@@ -253,8 +249,6 @@ describe('create-next-app prompts', () => {
const pkg = require(join(cwd, projectName, 'package.json'))
expect(pkg.name).toBe(projectName)
// Verify webpack is not in dev script
expect(pkg.scripts.dev).not.toContain('--webpack')
})
})
......@@ -273,7 +267,6 @@ describe('create-next-app prompts', () => {
srcDir: false,
importAlias: '@/*',
customizeImportAlias: false,
turbopack: false,
reactCompiler: false,
})
......
import { join } from 'node:path'
import {
projectShouldHaveNoGitChanges,
tryNextDev,
......@@ -66,7 +65,6 @@ describe('create-next-app --api (Headless App)', () => {
projectName,
'--js',
'--api',
'--no-turbopack',
'--no-src-dir',
'--no-import-alias',
...(process.env.NEXT_RSPACK ? ['--rspack'] : []),
......@@ -99,7 +97,6 @@ describe('create-next-app --api (Headless App)', () => {
projectName,
'--ts',
'--api',
'--no-turbopack',
'--no-src-dir',
'--no-import-alias',
...(process.env.NEXT_RSPACK ? ['--rspack'] : []),
......@@ -129,7 +126,6 @@ describe('create-next-app --api (Headless App)', () => {
projectName,
'--ts',
'--api',
'--no-turbopack',
'--src-dir',
'--no-import-alias',
...(process.env.NEXT_RSPACK ? ['--rspack'] : []),
......@@ -155,39 +151,4 @@ describe('create-next-app --api (Headless App)', () => {
})
})
})
;(process.env.NEXT_RSPACK ? it.skip : it)(
'should enable webpack dev with --webpack flag',
async () => {
await useTempDir(async (cwd) => {
const projectName = 'app-turbo'
const { exitCode } = await run(
[
projectName,
'--ts',
'--api',
'--webpack',
'--no-src-dir',
'--no-import-alias',
],
nextTgzFilename,
{
cwd,
}
)
// eslint-disable-next-line jest/no-standalone-expect
expect(exitCode).toBe(0)
const projectRoot = join(cwd, projectName)
const pkgJson = require(join(projectRoot, 'package.json'))
// eslint-disable-next-line jest/no-standalone-expect
expect(pkgJson.scripts.dev).toBe('next dev --webpack')
await tryNextDev({
cwd,
isApi: true,
projectName,
})
})
}
)
})
import { join } from 'node:path'
import {
projectShouldHaveNoGitChanges,
shouldBeTemplateProject,
......@@ -30,7 +29,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--js',
'--app',
'--no-turbopack',
'--eslint',
'--no-src-dir',
'--no-tailwind',
......@@ -61,7 +59,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--no-src-dir',
'--no-tailwind',
......@@ -90,7 +87,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--no-tailwind',
......@@ -128,7 +124,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--tailwind',
......@@ -165,7 +160,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--empty',
......@@ -205,7 +199,6 @@ describe('create-next-app --app (App Router)', () => {
projectName,
'--ts',
'--app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--tailwind',
......@@ -236,36 +229,4 @@ describe('create-next-app --app (App Router)', () => {
})
})
})
;(process.env.NEXT_RSPACK ? it.skip : it)(
'should enable webpack dev with --webpack flag',
async () => {
await useTempDir(async (cwd) => {
const projectName = 'app-turbo'
const { exitCode } = await run(
[
projectName,
'--ts',
'--app',
'--eslint',
'--webpack',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
'--no-react-compiler',
],
nextTgzFilename,
{
cwd,
}
)
// eslint-disable-next-line jest/no-standalone-expect
expect(exitCode).toBe(0)
const projectRoot = join(cwd, projectName)
const pkgJson = require(join(projectRoot, 'package.json'))
// eslint-disable-next-line jest/no-standalone-expect
expect(pkgJson.scripts.dev).toBe('next dev --webpack')
})
}
)
})
......@@ -21,8 +21,6 @@ describe.each(['app', 'pages'] as const)(
const allFlagValues = {
app: [isApp ? '--app' : '--no-app'],
turbo: [process.env.IS_TURBOPACK_TEST ? '--turbopack' : '--no-turbopack'],
ts: ['--js', '--ts'],
importAlias: [
'--import-alias=@acme/*',
......
import { join } from 'node:path'
import {
projectShouldHaveNoGitChanges,
run,
......@@ -30,7 +29,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--js',
'--no-app',
'--no-turbopack',
'--eslint',
'--no-src-dir',
'--no-tailwind',
......@@ -66,7 +64,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--ts',
'--no-app',
'--no-turbopack',
'--eslint',
'--no-src-dir',
'--no-tailwind',
......@@ -99,7 +96,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--ts',
'--no-app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--no-tailwind',
......@@ -136,7 +132,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--ts',
'--no-app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--tailwind',
......@@ -174,7 +169,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--ts',
'--no-app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--no-tailwind',
......@@ -215,7 +209,6 @@ describe('create-next-app --no-app (Pages Router)', () => {
projectName,
'--ts',
'--no-app',
'--no-turbopack',
'--eslint',
'--src-dir',
'--tailwind',
......@@ -247,36 +240,4 @@ describe('create-next-app --no-app (Pages Router)', () => {
})
})
})
;(process.env.NEXT_RSPACK ? it.skip : it)(
'should enable webpack dev with --webpack flag',
async () => {
await useTempDir(async (cwd) => {
const projectName = 'pages-turbo'
const { exitCode } = await run(
[
projectName,
'--ts',
'--no-app',
'--eslint',
'--webpack',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
'--no-react-compiler',
],
nextTgzFilename,
{
cwd,
}
)
// eslint-disable-next-line jest/no-standalone-expect
expect(exitCode).toBe(0)
const projectRoot = join(cwd, projectName)
const pkgJson = require(join(projectRoot, 'package.json'))
// eslint-disable-next-line jest/no-standalone-expect
expect(pkgJson.scripts.dev).toBe('next dev --webpack')
})
}
)
})
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