Skip to content

Commit 6372aea

Browse files
SyMindbgw
authored andcommitted
chore: upgrade rspack 1.6.0 (#84210)
1. Fixed the incremental update bug in buildChunkGraph. 2. Fixed a bug in Rspack's built-in CssChunkingPlugin. For detailed release information, please see https://github.com/web-infra-dev/rspack/releases. Note: All the faulty Rspack test cases on GitHub, from what I can see, either time out or also produce errors in Rspack version 1.5.0. --------- Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
1 parent 4557782 commit 6372aea

File tree

27 files changed

+340
-274
lines changed

27 files changed

+340
-274
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"@next/third-parties": "workspace:*",
147147
"@opentelemetry/api": "1.4.1",
148148
"@picocss/pico": "1.5.10",
149-
"@rspack/core": "1.5.0",
149+
"@rspack/core": "1.6.0",
150150
"@slack/web-api": "7.9.1",
151151
"@swc/cli": "0.1.55",
152152
"@swc/core": "1.11.24",

packages/next-rspack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
},
88
"types": "index.d.ts",
99
"dependencies": {
10-
"@next/rspack-core": "1.0.0"
10+
"@next/rspack-core": "1.0.1"
1111
}
1212
}

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"@next/swc": "16.0.2",
170170
"@opentelemetry/api": "1.6.0",
171171
"@playwright/test": "1.51.1",
172-
"@rspack/core": "1.5.0",
172+
"@rspack/core": "1.6.0",
173173
"@storybook/addon-a11y": "8.6.0",
174174
"@storybook/addon-essentials": "8.6.0",
175175
"@storybook/addon-interactions": "8.6.0",

packages/next/src/build/webpack-config.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ export function hasExternalOtelApiPackage(): boolean {
287287

288288
const UNSAFE_CACHE_REGEX = /[\\/]pages[\\/][^\\/]+(?:$|\?|#)/
289289

290+
const NEGATIVE_UNSAFE_CACHE_REGEX = new RegExp(
291+
`^(?!.*${UNSAFE_CACHE_REGEX.source}).*$`
292+
)
293+
290294
export function getCacheDirectories(
291295
configs: webpack.Configuration[]
292296
): Set<string> {
@@ -2255,12 +2259,8 @@ export default async function getBaseWebpackConfig(
22552259
}
22562260

22572261
if (isRspack) {
2258-
// @ts-ignore
2259-
// Disable Rspack's incremental buildChunkGraph due to Next.js compatibility issues
2260-
// TODO: Remove this workaround after Rspack 1.5.1 release
2261-
webpack5Config.experiments.incremental = {
2262-
buildChunkGraph: false,
2263-
}
2262+
// The layers experiment is now stable in Rspack
2263+
delete webpack5Config.experiments!.layers
22642264
}
22652265

22662266
webpack5Config.module!.parser = {
@@ -2486,11 +2486,22 @@ export default async function getBaseWebpackConfig(
24862486

24872487
if (dev) {
24882488
if (webpackConfig.module) {
2489-
webpackConfig.module.unsafeCache = (module: any) =>
2490-
!UNSAFE_CACHE_REGEX.test(module.resource)
2489+
if (isRspack) {
2490+
;(webpackConfig.module.unsafeCache as any) = NEGATIVE_UNSAFE_CACHE_REGEX
2491+
} else {
2492+
webpackConfig.module.unsafeCache = (module: any) =>
2493+
!UNSAFE_CACHE_REGEX.test(module.resource)
2494+
}
24912495
} else {
2492-
webpackConfig.module = {
2493-
unsafeCache: (module: any) => !UNSAFE_CACHE_REGEX.test(module.resource),
2496+
if (isRspack) {
2497+
;(webpackConfig.module as any) = {
2498+
unsafeCache: NEGATIVE_UNSAFE_CACHE_REGEX,
2499+
}
2500+
} else {
2501+
webpackConfig.module = {
2502+
unsafeCache: (module: any) =>
2503+
!UNSAFE_CACHE_REGEX.test(module.resource),
2504+
}
24942505
}
24952506
}
24962507
}

packages/next/src/compiled/sass-loader/cjs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

Lines changed: 241 additions & 194 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rspack/Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rspack/pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/development/acceptance-app/ReactRefreshLogBox-builtins.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import path from 'path'
44
import { outdent } from 'outdent'
55

66
describe('ReactRefreshLogBox-builtins app', () => {
7-
const { isTurbopack, next } = nextTestSetup({
7+
const { isTurbopack, next, isRspack } = nextTestSetup({
88
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
99
skipStart: true,
1010
})
1111

12-
const isRspack = !!process.env.NEXT_RSPACK
13-
1412
// Module trace is only available with webpack 5
1513
test('Node.js builtins', async () => {
1614
await using sandbox = await createSandbox(
@@ -135,10 +133,10 @@ describe('ReactRefreshLogBox-builtins app', () => {
135133
"label": "Build Error",
136134
"source": "./index.js
137135
× Module not found: Can't resolve 'b' in '<FIXME-project-root>'
138-
╭─[2:17]
136+
╭─[2:0]
139137
1 │ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
140138
2 │ import Comp from 'b';
141-
· ───
139+
· ─────────────────────
142140
3 │ export default function Oops() {
143141
4 │ return /*#__PURE__*/ _jsxDEV("div", {
144142
╰────
@@ -204,10 +202,10 @@ describe('ReactRefreshLogBox-builtins app', () => {
204202
"label": "Build Error",
205203
"source": "./app/page.js
206204
× Module not found: Can't resolve 'b' in '<FIXME-project-root>/app'
207-
╭─[2:17]
205+
╭─[2:0]
208206
1 │ /* __next_internal_client_entry_do_not_use__ default auto */ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
209207
2 │ import Comp from 'b';
210-
· ───
208+
· ─────────────────────
211209
3 │ export default function Oops() {
212210
4 │ return /*#__PURE__*/ _jsxDEV("div", {
213211
╰────
@@ -270,10 +268,10 @@ describe('ReactRefreshLogBox-builtins app', () => {
270268
"label": "Build Error",
271269
"source": "./app/page.js
272270
× Module not found: Can't resolve './non-existent.css' in '<FIXME-project-root>/app'
273-
╭─[2:7]
271+
╭─[2:0]
274272
1 │ /* __next_internal_client_entry_do_not_use__ default auto */ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
275273
2 │ import './non-existent.css';
276-
· ────────────────────
274+
· ────────────────────────────
277275
3 │ export default function Page(props) {
278276
4 │ return /*#__PURE__*/ _jsxDEV("p", {
279277
╰────",

test/development/acceptance-app/ReactRefreshLogBox.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import path from 'path'
66
import { outdent } from 'outdent'
77

88
describe('ReactRefreshLogBox app', () => {
9-
const { next, isTurbopack } = nextTestSetup({
9+
const { next, isTurbopack, isRspack } = nextTestSetup({
1010
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
1111
skipStart: true,
1212
patchFileDelay: 1000,
1313
})
1414

15-
const isRspack = !!process.env.NEXT_RSPACK
16-
1715
test('should strip whitespace correctly with newline', async () => {
1816
await using sandbox = await createSandbox(next)
1917
const { browser, session } = sandbox
@@ -1443,7 +1441,7 @@ describe('ReactRefreshLogBox app', () => {
14431441
× Module not found: Can't resolve 'non-existing-module' in '<FIXME-project-root>/app'
14441442
╭────
14451443
1 │ import "non-existing-module";
1446-
· ─────────────────────
1444+
· ─────────────────────────────
14471445
╰────
14481446
Import trace for requested module:
14491447
./app/module.js

0 commit comments

Comments
 (0)