Skip to content

Commit e24676b

Browse files
committed
Don’t use native built-ins for additional bundler
This opts us out of using the native built-in plugins for Rspack for now. The existing swc plugin we use for webpack does additional work beyond just swc transformation, including validating RSC components to make sure they don’t use React APIs unavailable in that context. In total, the native plugins result in a less than 20% performance gain which, while significant, isn’t necessary as we focus on correctness for now. If we decide the maintenance cost of maintaining multiple plugins in parity is worth the performance gain in the future, we can selectively re-enable some or all of these plugins. Test Plan: `pnpm test-dev-rspack test/development/acceptance/server-component-compiler-errors-in-pages.test.ts` no longer fails by missing the invalid React api messages.
1 parent 8df92f1 commit e24676b

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

.github/workflows/rspack-nextjs-build-integration-tests.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ jobs:
1414
name: rspack-production
1515
test_type: production
1616
run_before_test: |
17-
export NEXT_RSPACK=1 \
18-
NEXT_TEST_USE_RSPACK=1 \
19-
BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN=1 \
20-
BUILTIN_APP_LOADER=1 \
21-
BUILTIN_SWC_LOADER=1
17+
export NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1 \
2218
# Failing tests take longer (due to timeouts and retries). Since we have
2319
# many failing tests, we need smaller groups and longer timeouts, in case
2420
# a group gets stuck with a cluster of failing tests.

.github/workflows/rspack-nextjs-dev-integration-tests.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ jobs:
1414
name: rspack-development
1515
test_type: development
1616
run_before_test: |
17-
export NEXT_RSPACK=1 \
18-
NEXT_TEST_USE_RSPACK=1 \
19-
BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN=1 \
20-
BUILTIN_APP_LOADER=1 \
21-
BUILTIN_SWC_LOADER=1
17+
export NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1
2218
# Failing tests take longer (due to timeouts and retries). Since we have
2319
# many failing tests, we need smaller groups and longer timeouts, in case
2420
# a group gets stuck with a cluster of failing tests.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"storybook": "turbo run storybook",
7878
"build-storybook": "turbo run build-storybook",
7979
"test-storybook": "turbo run test-storybook",
80-
"with-rspack": "cross-env NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1 BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN=1 BUILTIN_APP_LOADER=1 BUILTIN_SWC_LOADER=1"
80+
"with-rspack": "cross-env NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1"
8181
},
8282
"devDependencies": {
8383
"@actions/core": "1.10.1",

packages/next-plugin-rspack/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module.exports = function withRspack(config) {
22
process.env.NEXT_RSPACK = 'true'
3-
process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN = 'true'
4-
process.env.BUILTIN_APP_LOADER = 'true'
5-
process.env.BUILTIN_SWC_LOADER = 'true'
3+
process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'
64
return config
75
}

test/lib/create-next-install.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ async function createNextInstall({
195195
// This is what the @next/plugin-rspack plugin does.
196196
// TODO: Load the plugin properly during test
197197
process.env.NEXT_RSPACK = 'true'
198-
process.env.BUILTIN_FLIGHT_CLIENT_ENTRY_PLUGIN = 'true'
199-
process.env.BUILTIN_APP_LOADER = 'true'
200-
process.env.BUILTIN_SWC_LOADER = 'true'
198+
process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'
201199
}
202200

203201
return {

0 commit comments

Comments
 (0)