Unverified Commit affb52da authored by Cong-Cong Pan's avatar Cong-Cong Pan Committed by GitHub

chore: update rspack 1.6.5 (#86853)

update @next/rspack-core version to 1.0.2 and update the snapshot

other changes:

- packages/next/src/build/webpack-config.ts
Adjusted configuration to account for differences in default node config
between Rspack and Webpack.

- packages/next/src/shared/lib/format-webpack-messages.ts
Added a fallback to moduleIdentifier in cases where Rspack does not
correctly populate moduleName.
parent 1427bf87
......@@ -142,7 +142,7 @@
"@next/third-parties": "workspace:*",
"@opentelemetry/api": "1.4.1",
"@picocss/pico": "1.5.10",
"@rspack/core": "1.6.0",
"@rspack/core": "1.6.7",
"@slack/web-api": "7.9.1",
"@swc/cli": "0.1.55",
"@swc/core": "1.11.24",
......
......@@ -7,6 +7,6 @@
},
"types": "index.d.ts",
"dependencies": {
"@next/rspack-core": "1.0.1"
"@next/rspack-core": "1.0.2"
}
}
......@@ -169,7 +169,7 @@
"@next/swc": "16.1.0-canary.30",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.51.1",
"@rspack/core": "1.6.0",
"@rspack/core": "1.6.7",
"@storybook/addon-a11y": "8.6.0",
"@storybook/addon-essentials": "8.6.0",
"@storybook/addon-interactions": "8.6.0",
......
......@@ -2263,6 +2263,15 @@ export default async function getBaseWebpackConfig(
if (isRspack) {
// The layers experiment is now stable in Rspack
delete webpack5Config.experiments!.layers
if (!webpack5Config.node) {
webpack5Config.node = {}
}
// NOTE: Rspack's defaults differ from webpack.
if (isClient || isEdgeServer) {
webpack5Config.node.__dirname = 'mock'
webpack5Config.node.__filename = 'mock'
}
}
webpack5Config.module!.parser = {
......
......@@ -59,6 +59,18 @@ function formatMessage(
body = body.slice(0, breakingChangeIndex)
}
// TODO: Rspack currently doesn't populate moduleName correctly in some cases,
// fall back to moduleIdentifier as a workaround
if (
process.env.NEXT_RSPACK &&
!message.moduleName &&
!message.file &&
message.moduleIdentifier
) {
const parts = message.moduleIdentifier.split('!')
message.moduleName = parts[parts.length - 1]
}
message =
(message.moduleName ? stripAnsi(message.moduleName) + '\n' : '') +
(message.file ? stripAnsi(message.file) + '\n' : '') +
......
This diff is collapsed.
......@@ -294,11 +294,10 @@ describe('ReactRefreshLogBox app', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`?",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`?
│ ,-[7:1]
│ 4 | <p>lol</p>
......@@ -495,11 +494,10 @@ describe('ReactRefreshLogBox app', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × SyntaxError",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css
× Module build failed:
╰─▶ × SyntaxError
│
│ (1:1) <FIXME-project-root>/index.module.css Unknown word
......@@ -559,11 +557,10 @@ describe('ReactRefreshLogBox app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × CssSyntaxError",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css
× Module build failed:
╰─▶ × CssSyntaxError
│
│ (1:1) Selector "button" is not pure (pure selectors must contain at least one local class or id)
......@@ -1056,6 +1053,21 @@ describe('ReactRefreshLogBox app', () => {
],
}
`)
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "test",
"environmentLabel": null,
"label": "Runtime Error",
"source": "index.js (3:11) @ __rspack_default_export
> 3 | throw new Error('test')
| ^",
"stack": [
"__rspack_default_export index.js (3:11)",
"Page app/page.js (4:10)",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
......@@ -1504,13 +1516,12 @@ describe('ReactRefreshLogBox app', () => {
}
`)
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " ╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
"description": "Failed to compile",
"environmentLabel": null,
"label": "Build Error",
"source": "× Module build failed:
╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
"source": "╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
"stack": [],
}
`)
......
......@@ -47,11 +47,10 @@ describe('ReactRefreshLogBox app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.js
× Module build failed:
╰─▶ × Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
│ |
│
......
......@@ -56,11 +56,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '>', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '>', got '<eof>'
│ ,----
│ 1 | export default () => <div/
......@@ -150,11 +149,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/server/page.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[2:1]
│ 1 | export default function Page() {
......@@ -235,11 +233,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/client/page.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[2:1]
│ 1 | export default function Page() {
......@@ -671,11 +668,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[10:1]
│ 7 | throw Error('no ' + i)
......@@ -732,11 +728,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[10:1]
│ 7 | throw Error('no ' + i)
......@@ -925,11 +920,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got 'return'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '{', got 'return'
│ ,-[5:1]
│ 2 |
......@@ -1009,11 +1003,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got 'throw'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '{', got 'throw'
│ ,-[5:1]
│ 2 |
......@@ -1136,11 +1129,10 @@ describe('Error recovery app', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,----
│ 1 | {{{
......
......@@ -119,11 +119,10 @@ describe('ReactRefreshLogBox _app _document', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expression expected",
"environmentLabel": null,
"label": "Build Error",
"source": "./pages/_app.js
× Module build failed:
╰─▶ × Error: x Expression expected
│ ,-[2:1]
│ 1 | function MyApp({ Component, pageProps }) {
......@@ -239,11 +238,10 @@ describe('ReactRefreshLogBox _app _document', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key",
"environmentLabel": null,
"label": "Build Error",
"source": "./pages/_document.js
× Module build failed:
╰─▶ × Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key
│ ,-[3:1]
│ 1 | import Document, { Html, Head, Main, NextScript } from 'next/document'
......
......@@ -455,11 +455,10 @@ describe('ReactRefreshLogBox', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
│ ,-[7:1]
│ 4 | <p>lol</p>
......@@ -709,11 +708,10 @@ describe('ReactRefreshLogBox', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × SyntaxError",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css
× Module build failed:
╰─▶ × SyntaxError
│
│ (1:1) <FIXME-project-root>/index.module.css Unknown word
......@@ -771,11 +769,10 @@ describe('ReactRefreshLogBox', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × CssSyntaxError",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css
× Module build failed:
╰─▶ × CssSyntaxError
│
│ (1:1) Selector "button" is not pure (pure selectors must contain at least one local class or id)
......
......@@ -6,7 +6,7 @@ import { outdent } from 'outdent'
import path from 'path'
describe('ReactRefreshRegression', () => {
const { isTurbopack, next } = nextTestSetup({
const { isTurbopack, isRspack, next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
skipStart: true,
dependencies: {
......@@ -295,6 +295,20 @@ describe('ReactRefreshRegression', () => {
],
}
`)
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "boom",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/index.js (1:36) @ __rspack_default_export
> 1 | export default function () { throw new Error('boom'); }
| ^",
"stack": [
"__rspack_default_export pages/index.js (1:36)",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
......
......@@ -58,11 +58,10 @@ describe('pages/ error recovery', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '>', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '>', got '<eof>'
│ ,----
│ 1 | export default () => <div/
......@@ -403,11 +402,10 @@ describe('pages/ error recovery', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got 'return'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '{', got 'return'
│ ,-[5:1]
│ 2 |
......@@ -488,11 +486,10 @@ describe('pages/ error recovery', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got 'throw'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '{', got 'throw'
│ ,-[5:1]
│ 2 |
......@@ -823,11 +820,10 @@ describe('pages/ error recovery', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[7:1]
│ 4 | i++
......@@ -889,11 +885,10 @@ describe('pages/ error recovery', () => {
} else if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.js
× Module build failed:
╰─▶ × Error: x Expected '}', got '<eof>'
│ ,-[7:1]
│ 4 | i++
......
......@@ -81,7 +81,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
)
).toMatchInlineSnapshot(`
"./components/Comp.js
× Module build failed:
╰─▶ × Error: x You're importing a component that needs "next/headers". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
│ |
│
......@@ -165,7 +164,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
)
).toMatchInlineSnapshot(`
"./components/Comp.js
× Module build failed:
╰─▶ × Error: x You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
│ |
│
......@@ -251,7 +249,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
)
).toMatchInlineSnapshot(`
"./components/Comp.js
× Module build failed:
╰─▶ × Error: x You're importing a component that needs "after". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
│ |
│
......@@ -346,7 +343,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
)
).toMatchInlineSnapshot(`
"./components/Comp.js
× Module build failed:
╰─▶ × Error: x You're importing a component that needs "next/root-params". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
│ |
│
......
......@@ -2,7 +2,7 @@ import { nextTestSetup } from 'e2e-utils'
import stripAnsi from 'strip-ansi'
describe('build-error-logs', () => {
const { next, isTurbopack } = nextTestSetup({
const { next, isTurbopack, isRspack } = nextTestSetup({
files: __dirname,
})
......@@ -18,6 +18,8 @@ describe('build-error-logs', () => {
if (isTurbopack) {
expect(moduleNotFoundLogs).toHaveLength(1)
} else if (isRspack) {
expect([2, 3]).toContain(moduleNotFoundLogs.length)
} else {
// FIXME: next with webpack still logs the same error too many times
expect(moduleNotFoundLogs).toHaveLength(3)
......
......@@ -151,11 +151,10 @@ describe('Cache Components Dev Errors', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.tsx
× Module build failed:
╰─▶ × Error: x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.
│ ,-[1:1]
│ 1 | export const revalidate = 10
......
......@@ -37,11 +37,10 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
`)
} else if (process.env.NEXT_RSPACK) {
expect(redbox.description).toMatchInlineSnapshot(
`" × Module build failed:"`
`" ╰─▶ × Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component."`
)
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js
× Module build failed:
╰─▶ × Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component.
│ ,-[3:1]
│ 1 | import dynamic from 'next/dynamic'
......
......@@ -192,11 +192,10 @@ describe('react-dom/server in React Server environment', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.",
"environmentLabel": null,
"label": "Build Error",
"source": "<FIXME-nextjs-internal-source>
× Module build failed:
╰─▶ × Error: x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
│ | Learn more: https://nextjs.org/docs/app/building-your-application/rendering
│ ,-[1:1]
......@@ -341,9 +340,8 @@ describe('react-dom/server in React Server environment', () => {
} else if (isRspack) {
expect(redbox).toMatchInlineSnapshot(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js
× Module build failed:
╰─▶ × Error: x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
│ | Learn more: https://nextjs.org/docs/app/building-your-application/rendering
│ ,-[1:1]
......
......@@ -175,30 +175,29 @@ export function runErrorRecoveryHmrTest(nextConfig: {
`)
} else if (process.env.NEXT_RSPACK) {
expect(trimEndMultiline(source)).toMatchInlineSnapshot(`
"./pages/hmr/about2.js
× Module build failed:
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
│ ,-[7:1]
│ 4 | <p>This is the about page.</p>
│ 5 | div
│ 6 | )
│ 7 | }
│ : ^
│ \`----
│ x Expected '</', got '<eof>'
│ ,-[7:3]
│ 5 | div
│ 6 | )
│ 7 | }
│ \`----
│
│
│ Caused by:
│ Syntax Error
Import trace for requested module:
./pages/hmr/about2.js"
`)
"./pages/hmr/about2.js
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
│ ,-[7:1]
│ 4 | <p>This is the about page.</p>
│ 5 | div
│ 6 | )
│ 7 | }
│ : ^
│ \`----
│ x Expected '</', got '<eof>'
│ ,-[7:3]
│ 5 | div
│ 6 | )
│ 7 | }
│ \`----
│
│
│ Caused by:
│ Syntax Error
Import trace for requested module:
./pages/hmr/about2.js"
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js
......@@ -537,26 +536,25 @@ export function runErrorRecoveryHmrTest(nextConfig: {
} else if (process.env.NEXT_RSPACK) {
expect(trimEndMultiline(next.normalizeTestDirContent(redboxSource)))
.toMatchInlineSnapshot(`
"./components/parse-error.js
× Module build failed:
╰─▶ × Error: x Expression expected
│ ,-[3:1]
│ 1 | This
│ 2 | is
│ 3 | }}}
│ : ^
│ 4 | invalid
│ 5 | js
│ \`----
│
│
│ Caused by:
│ Syntax Error
Import trace for requested module:
./components/parse-error.js
./pages/hmr/about9.js"
`)
"./components/parse-error.js
╰─▶ × Error: x Expression expected
│ ,-[3:1]
│ 1 | This
│ 2 | is
│ 3 | }}}
│ : ^
│ 4 | invalid
│ 5 | js
│ \`----
│
│
│ Caused by:
│ Syntax Error
Import trace for requested module:
./components/parse-error.js
./pages/hmr/about9.js"
`)
} else {
redboxSource = redboxSource.substring(
0,
......
......@@ -170,7 +170,6 @@ describe('mcp-server get_errors tool', () => {
\`\`\`
./app/build-error/page.tsx
× Module build failed:
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
│ ,-[4:1]
│ 1 | export default function BuildErrorPage() {
......
......@@ -37,7 +37,11 @@ describe('middleware - development errors', () => {
// TODO(veil): Sourcemap to original name i.e. "default"
'\n at __TURBOPACK__default__export__ (middleware.js:3:15)' +
'\n 1 |'
: '\n⨯ Error: boom' +
: isRspack
? '\n⨯ Error: boom' +
'\n at __rspack_default_export (middleware.js:3:15)' +
'\n 1 |'
: '\n⨯ Error: boom' +
'\n at default (middleware.js:3:15)' +
'\n 1 |'
)
......@@ -71,11 +75,11 @@ describe('middleware - development errors', () => {
"description": "boom",
"environmentLabel": null,
"label": "Runtime Error",
"source": "middleware.js (3:15) @ default
"source": "middleware.js (3:15) @ __rspack_default_export
> 3 | throw new Error('boom')
| ^",
"stack": [
"default middleware.js (3:15)",
"__rspack_default_export middleware.js (3:15)",
],
}
`)
......@@ -134,7 +138,12 @@ describe('middleware - development errors', () => {
// TODO(veil): Sourcemap to original name i.e. "default"
'\n at __TURBOPACK__default__export__ (middleware.js:7:9)' +
"\n 2 | import { NextResponse } from 'next/server'"
: '\n⨯ unhandledRejection: Error: async boom!' +
: isRspack
? '\n⨯ unhandledRejection: Error: async boom!' +
'\n at throwError (middleware.js:4:15)' +
'\n at __rspack_default_export (middleware.js:7:9)' +
"\n 2 | import { NextResponse } from 'next/server'"
: '\n⨯ unhandledRejection: Error: async boom!' +
'\n at throwError (middleware.js:4:15)' +
'\n at default (middleware.js:7:9)' +
"\n 2 | import { NextResponse } from 'next/server'"
......@@ -234,12 +243,12 @@ describe('middleware - development errors', () => {
"description": "test is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "middleware.js (4:9) @ default
"source": "middleware.js (4:9) @ __rspack_default_export
> 4 | eval('test')
| ^",
"stack": [
"<FIXME-file-protocol>",
"default middleware.js (4:9)",
"__rspack_default_export middleware.js (4:9)",
],
}
`)
......@@ -297,7 +306,13 @@ describe('middleware - development errors', () => {
? '\n⨯ Error: booooom!' +
// TODO(veil): Should be sourcemapped
'\n at module evaluation (middleware.js:3:13)'
: '\n⨯ Error: booooom!' +
: isRspack
? '\n⨯ Error: booooom!' +
`\n at <unknown> (${getDistDir()}/server/edge-runtime-webpack.js:35)` +
'\n at eval (middleware.js:3:13)' +
`\n at (middleware)/./middleware.js (${getDistDir()}/server/middleware.js:26:1)` +
'\n at __webpack_require__ '
: '\n⨯ Error: booooom!' +
// TODO: Should be anonymous method without a method name
'\n at <unknown> (middleware.js:3)' +
// TODO: Should be ignore-listed
......@@ -490,11 +505,10 @@ describe('middleware - development errors', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got '}'",
"environmentLabel": null,
"label": "Build Error",
"source": "./middleware.js
× Module build failed:
╰─▶ × Error: x Expected '{', got '}'
│ ,----
│ 1 | export default function () }
......@@ -576,11 +590,10 @@ describe('middleware - development errors', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Expected '{', got '}'",
"environmentLabel": null,
"label": "Build Error",
"source": "./middleware.js
× Module build failed:
╰─▶ × Error: x Expected '{', got '}'
│ ,----
│ 1 | export default function () }
......
......@@ -244,6 +244,20 @@ describe('Client Navigation rendering', () => {
],
}
`)
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "This is an expected error",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/error-inside-page.js (2:9) @ __rspack_default_export
> 2 | throw new Error('This is an expected error')
| ^",
"stack": [
"__rspack_default_export pages/error-inside-page.js (2:9)",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
......
......@@ -1102,7 +1102,7 @@ describe('Cache Components Errors', () => {
],
},
{
"description": "(0 , <webpack-module-id>.cookies)(...).get is not a function",
"description": "(0 , next_headers__rspack_import_1.cookies)(...).get is not a function",
"environmentLabel": "Prerender",
"label": "Runtime TypeError",
"source": "app/sync-cookies/page.tsx (18:36) @ CookiesReadingComponent
......@@ -1284,7 +1284,7 @@ describe('Cache Components Errors', () => {
],
},
{
"description": "(0 , <webpack-module-id>.cookies)(...).get is not a function",
"description": "(0 , next_headers__rspack_import_1.cookies)(...).get is not a function",
"environmentLabel": "Server",
"label": "Runtime TypeError",
"source": "app/sync-cookies-runtime/page.tsx (24:36) @ CookiesReadingComponent
......@@ -1438,7 +1438,7 @@ describe('Cache Components Errors', () => {
],
},
{
"description": "(0 , <webpack-module-id>.headers)(...).get is not a function",
"description": "(0 , next_headers__rspack_import_1.headers)(...).get is not a function",
"environmentLabel": "Prerender",
"label": "Runtime TypeError",
"source": "app/sync-headers/page.tsx (18:40) @ HeadersReadingComponent
......@@ -1620,7 +1620,7 @@ describe('Cache Components Errors', () => {
],
},
{
"description": "(0 , <webpack-module-id>.headers)(...).get is not a function",
"description": "(0 , next_headers__rspack_import_1.headers)(...).get is not a function",
"environmentLabel": "Server",
"label": "Runtime TypeError",
"source": "app/sync-headers-runtime/page.tsx (24:40) @ HeadersReadingComponent
......
......@@ -40,7 +40,6 @@ describe('app-dir - error-on-next-codemod-comment', () => {
} else if (process.env.NEXT_RSPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx
× Module build failed:
╰─▶ × Error: x You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
│ | After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken.
│
......
......@@ -52,8 +52,7 @@ describe('CSS Import from node_modules', () => {
`)
} else if (isRspack) {
expect(errorSource).toMatchInlineSnapshot(`
"./node_modules/.pnpm/next@file+..+next-repo-9363c99f3d71d8f039ab2f44b0982247ca3f251f6a3cb48f6f97e14bd6290b68_3cf165911481a65b93532bfb8e2c9025/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[8].oneOf[14].use[1]!./node_modules/.pnpm/next@file+..+next-repo-9363c99f3d71d8f039ab2f44b0982247ca3f251f6a3cb48f6f97e14bd6290b68_3cf165911481a65b93532bfb8e2c9025/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[8].oneOf[14].use[2]!./node_modules/.pnpm/next@file+..+next-repo-9363c99f3d71d8f039ab2f44b0982247ca3f251f6a3cb48f6f97e14bd6290b68_3cf165911481a65b93532bfb8e2c9025/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[8].oneOf[14].use[3]!./node_modules/.pnpm/next@file+..+next-repo-9363c99f3d71d8f039ab2f44b0982247ca3f251f6a3cb48f6f97e14bd6290b68_3cf165911481a65b93532bfb8e2c9025/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[8].oneOf[14].use[4]!./styles/global.scss
× Module build failed:
"./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[9].oneOf[14].use[1]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[9].oneOf[14].use[2]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[9].oneOf[14].use[3]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[9].oneOf[14].use[4]!./styles/global.scss
╰─▶ × Error: RspackResolver(NotFound("nprogress/nprogress.css"))"
`)
} else {
......
......@@ -35,11 +35,10 @@ describe('use-cache-segment-configs', () => {
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": " × Module build failed:",
"description": " ╰─▶ × Error: x Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.",
"environmentLabel": null,
"label": "Build Error",
"source": "<FIXME-nextjs-internal-source>
× Module build failed:
╰─▶ × Error: x Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
│ ,-[1:1]
│ 1 | export const runtime = 'edge'
......@@ -98,7 +97,6 @@ describe('use-cache-segment-configs', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"
// TODO(veil): Fix broken import trace for Webpack loader resource.
× Module build failed:
╰─▶ × Error: x Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
│ ,-[1:1]
│ 1 | export const runtime = 'edge'
......
......@@ -50,7 +50,6 @@ describe('use-cache-unknown-cache-kind', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"
./app/page.tsx
× Module build failed:
╰─▶ × Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config.
│
│ ,-[1:1]
......@@ -118,7 +117,7 @@ describe('use-cache-unknown-cache-kind', () => {
)
} else if (isRspack) {
expect(errorDescription).toMatchInlineSnapshot(
`" × Module build failed:"`
`" ╰─▶ × Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config."`
)
} else {
expect(errorDescription).toMatchInlineSnapshot(
......@@ -141,9 +140,8 @@ describe('use-cache-unknown-cache-kind', () => {
} else if (isRspack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
× Module build failed:
╰─▶ × Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config.
│ |
│
│ ,-[1:1]
│ 1 | 'use cache: custom'
│ : ^^^^^^^^^^^^^^^^^^^
......
......@@ -53,7 +53,6 @@ describe('use-cache-without-experimental-flag', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"
./app/page.tsx
× Module build failed:
╰─▶ × Error: x To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
│ |
│ | Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
......@@ -114,7 +113,7 @@ describe('use-cache-without-experimental-flag', () => {
)
} else if (isRspack) {
expect(errorDescription).toMatchInlineSnapshot(
`" × Module build failed:"`
`" ╰─▶ × Error: x To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config."`
)
} else {
expect(errorDescription).toMatchInlineSnapshot(
......@@ -139,7 +138,6 @@ describe('use-cache-without-experimental-flag', () => {
} else if (isRspack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
× Module build failed:
╰─▶ × Error: x To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
│ |
│ | Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
......
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