Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 16 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ jobs:

export NEXT_TEST_MODE=start
export NEXT_TEST_WASM=true
export IS_WEBPACK_TEST=1
node run-tests.js \
test/production/pages-dir/production/test/index.test.ts \
test/e2e/streaming-ssr/index.test.ts
Expand Down Expand Up @@ -711,7 +712,7 @@ jobs:

secrets: inherit

test-dev:
test-dev: # TODO: rename to include webpack
name: test dev
needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
Expand All @@ -728,6 +729,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: |
export IS_WEBPACK_TEST=1
export NEXT_TEST_MODE=dev
export NEXT_TEST_REACT_VERSION="${{ matrix.react }}"

Expand All @@ -752,8 +754,10 @@ jobs:

uses: ./.github/workflows/build_reusable.yml
with:
# Should this be using turbopack? a variation?
afterBuild: |
export NEXT_TEST_MODE=dev
export IS_WEBPACK_TEST=1

node run-tests.js \
test/e2e/app-dir/app/index.test.ts \
Expand All @@ -780,6 +784,7 @@ jobs:
with:
nodeVersion: 20.9.0
afterBuild: |
export IS_WEBPACK_TEST=1
node run-tests.js \
--concurrency 4 \
test/production/pages-dir/production/test/index.test.ts \
Expand Down Expand Up @@ -808,6 +813,7 @@ jobs:
with:
afterBuild: |
export NEXT_TEST_MODE=start
export IS_WEBPACK_TEST=1

node run-tests.js --type production \
test/e2e/app-dir/app/index.test.ts \
Expand Down Expand Up @@ -836,6 +842,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: |
export IS_WEBPACK_TEST=1
export NEXT_TEST_MODE=start
export NEXT_TEST_REACT_VERSION="${{ matrix.react }}"

Expand Down Expand Up @@ -875,6 +882,7 @@ jobs:
with:
nodeVersion: 20.9.0
afterBuild: |
export IS_WEBPACK_TEST=1
export NEXT_TEST_REACT_VERSION="${{ matrix.react }}"

node run-tests.js \
Expand All @@ -896,6 +904,7 @@ jobs:

# these all run without concurrency because they're heavier
export TEST_CONCURRENCY=1
export IS_WEBPACK_TEST=1

BROWSER_NAME=firefox node run-tests.js \
test/production/pages-dir/production/test/index.test.ts
Expand Down Expand Up @@ -923,6 +932,7 @@ jobs:
afterBuild: |
export __NEXT_EXPERIMENTAL_PPR=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json"
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand All @@ -945,6 +955,7 @@ jobs:
export __NEXT_EXPERIMENTAL_PPR=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json"
export NEXT_TEST_MODE=dev
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand All @@ -968,6 +979,7 @@ jobs:
export __NEXT_EXPERIMENTAL_PPR=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json"
export NEXT_TEST_MODE=start
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand All @@ -990,6 +1002,7 @@ jobs:
export __NEXT_EXPERIMENTAL_PPR=true # for compatibility with the existing tests
export __NEXT_EXPERIMENTAL_CACHE_COMPONENTS=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/experimental-tests-manifest.json"
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand All @@ -1014,6 +1027,7 @@ jobs:
export NEXT_EXTERNAL_TESTS_FILTERS="test/experimental-tests-manifest.json"
export NEXT_TEST_MODE=dev
export __NEXT_EXPERIMENTAL_ISOLATED_DEV_BUILD=true
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand All @@ -1038,6 +1052,7 @@ jobs:
export __NEXT_EXPERIMENTAL_CACHE_COMPONENTS=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/experimental-tests-manifest.json"
export NEXT_TEST_MODE=start
export IS_WEBPACK_TEST=1

node run-tests.js \
--timings \
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ jobs:

- uses: ./.github/actions/next-stats-action
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
env:
# This uses the webpack bundle analyzer and for consistent results we need to use webpack.
# Once there is an equivalent analyzer for turbopack, we can remove this.
IS_WEBPACK_TEST: 1
10 changes: 9 additions & 1 deletion .github/workflows/test_e2e_deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ jobs:
matrix:
group: [1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 7/8, 8/8]
with:
afterBuild: npm i -g vercel@latest && NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=deploy NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || 'canary' }}" VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" node run-tests.js --timings -g ${{ matrix.group }} -c 2 --type e2e
afterBuild: |
npm i -g vercel@latest && \
NEXT_E2E_TEST_TIMEOUT=240000 \
NEXT_TEST_MODE=deploy \
IS_WEBPACK_TEST=1 \
NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \
NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || 'canary' }}" \
VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \
node run-tests.js --timings -g ${{ matrix.group }} -c 2 --type e2e
skipNativeBuild: 'yes'
skipNativeInstall: 'no'
stepName: 'test-deploy-${{ matrix.group }}'
Expand Down
4 changes: 2 additions & 2 deletions bench/heavy-npm-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"scripts": {
"dev-turbopack": "next dev --turbopack",
"dev-webpack": "next dev",
"dev-webpack": "next dev --webpack",
"build-turbopack": "next build --turbopack",
"build-webpack": "next build",
"build-webpack": "next build --webpack",
"start-turbopack": "next start",
"start-webpack": "next start",
"build-application": "next build",
Expand Down
8 changes: 4 additions & 4 deletions bench/module-cost/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"scripts": {
"prepare-bench": "node scripts/prepare-bench.mjs",
"benchmark": "node scripts/benchmark-runner.mjs",
"dev-webpack": "next dev",
"dev-turbopack": "next dev --turbo",
"build-webpack": "next build",
"build-turbopack": "next build --turbo",
"dev-webpack": "next dev --webpack",
"dev-turbopack": "next dev --turbopack",
"build-webpack": "next build --webpack",
"build-turbopack": "next build --turbopack",
"start": "next start"
},
"devDependencies": {
Expand Down
67 changes: 44 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,49 @@
"ci:publish": "tsx ./scripts/release/publish-npm.ts",
"test-types": "tsc",
"test-unit": "jest test/unit/ packages/next/ packages/font",
"test-dev": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",
"test-dev-experimental": "cross-env NEXT_TEST_MODE=dev pnpm run with-experimental pnpm testheadless",
"test-dev-rspack": "pnpm run with-rspack pnpm run test-dev",
"test-dev-experimental-rspack": "pnpm run with-rspack pnpm run test-dev-experimental",
"test-dev-turbo": "cross-env NEXT_TEST_MODE=dev IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm testheadless",
"test-dev-experimental-turbo": "cross-env NEXT_TEST_MODE=dev IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm run with-experimental pnpm testheadless",
"test-start": "cross-env NEXT_TEST_MODE=start pnpm testheadless",
"test-start-experimental": "cross-env NEXT_TEST_MODE=start pnpm run with-experimental pnpm testheadless",
"test-start-rspack": "pnpm run with-rspack pnpm run test-start",
"test-start-experimental-rspack": "pnpm run with-rspack pnpm run test-start-experimental",
"test-start-turbo": "cross-env NEXT_TEST_MODE=start IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm testheadless",
"test-start-experimental-turbo": "cross-env NEXT_TEST_MODE=start IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm run with-experimental pnpm testheadless",
"test-deploy": "cross-env NEXT_TEST_MODE=deploy pnpm testheadless",
"testonly-dev": "cross-env NEXT_TEST_MODE=dev pnpm testonly",
"testonly-dev-rspack": "pnpm run with-rspack pnpm run testonly-dev",
"testonly-dev-turbo": "cross-env NEXT_TEST_MODE=dev IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm testonly",
"testonly-start": "cross-env NEXT_TEST_MODE=start pnpm testonly",
"testonly-start-rspack": "pnpm run with-rspack pnpm run testonly-start",
"testonly-start-turbo": "cross-env NEXT_TEST_MODE=start IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm testonly",
"testonly-deploy": "cross-env NEXT_TEST_MODE=deploy pnpm testonly",
"test": "pnpm testheadless",
"test-rspack": "pnpm run with-rspack pnpm run test",
"test-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 TURBOPACK_BUILD=1 pnpm testheadless",
"test-dev-inner": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",
"test-dev": "pnpm run test-dev-webpack",
"test-dev-webpack": "pnpm run with-webpack pnpm test-dev-inner",
"test-dev-experimental-inner": "pnpm run with-experimental pnpm test-dev-inner",
"test-dev-experimental": "pnpm run test-dev-experimental-webpack",
"test-dev-experimental-webpack": "pnpm run with-webpack pnpm test-dev-experimental-inner",
"test-dev-rspack": "pnpm run with-rspack pnpm run test-dev-inner",
"test-dev-experimental-rspack": "pnpm run with-rspack pnpm run test-dev-experimental-inner",
"test-dev-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm test-dev-inner",
"test-dev-experimental-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm run with-experimental pnpm test-dev-inner",
"test-start-inner": "cross-env NEXT_TEST_MODE=start pnpm testheadless",
"test-start": "pnpm run test-start-webpack",
"test-start-webpack": "pnpm run with-webpack pnpm run test-start-inner",
"test-start-experimental-inner": "pnpm run with-experimental pnpm test-start-inner",
"test-start-experimental": "pnpm run test-start-experimental-webpack",
"test-start-experimental-webpack": "pnpm run with-webpack pnpm run test-start-experimental-inner",
"test-start-rspack": "pnpm run with-rspack pnpm run test-start-inner",
"test-start-experimental-rspack": "pnpm run with-rspack pnpm run test-start-experimental-inner",
"test-start-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm test-start-inner",
"test-start-experimental-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm run with-experimental pnpm test-start-experimental-inner",
"test-deploy-inner": "cross-env NEXT_TEST_MODE=deploy pnpm testheadless",
"test-deploy": "pnpm run test-deploy-webpack",
"test-deploy-webpack": "pnpm run with-webpack pnpm test-deploy-inner",
"test-deploy-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm test-deploy-inner",
"testonly-dev-inner": "cross-env NEXT_TEST_MODE=dev pnpm testonly",
"testonly-dev": "pnpm run testonly-dev-webpack",
"testonly-dev-webpack": "pnpm run with-webpack pnpm run testonly-dev-inner",
"testonly-dev-rspack": "pnpm run with-rspack pnpm run testonly-dev-inner",
"testonly-dev-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 pnpm testonly-dev-inner",
"testonly-start-inner": "cross-env NEXT_TEST_MODE=start pnpm testonly",
"testonly-start": "pnpm run testonly-start-webpack",
"testonly-start-webpack": "pnpm run with-webpack pnpm run testonly-start-inner",
"testonly-start-rspack": "pnpm run with-rspack pnpm run testonly-start-inner",
"testonly-start-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm testonly-start-inner",
"testonly-deploy-inner": "cross-env NEXT_TEST_MODE=deploy pnpm testonly",
"testonly-deploy": "pnpm run testonly-deploy-webpack",
"testonly-deploy-webpack": "pnpm run with-webpack pnpm run testonly-deploy-inner",
"testonly-deploy-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_BUILD=1 pnpm testonly-deploy-inner",
"test-inner": "pnpm testheadless",
"test": "pnpm test-webpack",
"test-webpack": "pnpm run with-webpack pnpm run test-inner",
"test-rspack": "pnpm run with-rspack pnpm run test-inner",
"test-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK_DEV=1 TURBOPACK_BUILD=1 pnpm test-inner",
"testonly": "jest --runInBand",
"testheadless": "cross-env HEADLESS=true pnpm testonly",
"genstats": "cross-env LOCAL_STATS=true node .github/actions/next-stats-action/src/index.js",
Expand Down Expand Up @@ -89,6 +109,7 @@
"build-storybook": "turbo run build-storybook",
"test-storybook": "turbo run test-storybook",
"with-rspack": "cross-env NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1",
"with-webpack": "cross-env IS_WEBPACK_TEST=1",
"with-experimental": "cross-env __NEXT_EXPERIMENTAL_CACHE_COMPONENTS=true __NEXT_EXPERIMENTAL_PPR=true"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/next-rspack/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module.exports = function withRspack(config) {
process.env.NEXT_RSPACK = 'true'
process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'
if (process.env.TURBOPACK === 'auto') {
// If next has defaulted to turbopack, override it.
delete process.env.TURBOPACK
} else {
console.error(
`Cannot call withRspack and pass the ${process.env.TURBOPACK ? '--turbopack' : '--webpack'} flag.`
)
console.error('Please configure only one bundler.')
process.exit(1)
}
return config
}
6 changes: 4 additions & 2 deletions packages/next/src/bin/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ program
.option('--no-mangling', 'Disables mangling.')
.option('--profile', 'Enables production profiling for React.')
.option('--experimental-app-only', 'Builds only App Router routes.')
.option('--turbo', 'Starts development mode using Turbopack.')
.option('--turbopack', 'Starts development mode using Turbopack.')
.option('--turbo', 'Builds using Turbopack.')
.option('--turbopack', 'Builds using Turbopack.')
.option('--webpack', 'Builds using webpack.')
.addOption(
new Option(
'--experimental-build-mode [mode]',
Expand Down Expand Up @@ -173,6 +174,7 @@ program
)
.option('--turbo', 'Starts development mode using Turbopack.')
.option('--turbopack', 'Starts development mode using Turbopack.')
.option('--webpack', 'Starts development mode using webpack.')
.addOption(
new Option(
'-p, --port <port>',
Expand Down
Loading
Loading