Repository: vercel/next.js
Pull request: fix: update rspack production build output snapshot

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to understand the PR)
- When linking to a Slack thread, you might want to share details of the conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

update build output snapshots in following test cases for Rspack.

- test/e2e/app-dir/use-cache-segment-configs/use-cache-segment-configs.test.ts
- test/e2e/app-dir/use-cache-unknown-cache-kind/use-cache-unknown-cache-kind.test.ts
- test/e2e/app-dir/use-cache-without-experimental-flag/use-cache-without-experimental-flag.test.ts
- test/integration/css-minify/test/index.test.js

Changed files:
filename: test/e2e/app-dir/use-cache-segment-configs/use-cache-segment-configs.test.ts
patch: @@ -2,6 +2,8 @@ import { nextTestSetup } from 'e2e-utils'
 import { assertHasRedbox } from 'next-test-utils'
 import stripAnsi from 'strip-ansi'
 
+const isRspack = !!process.env.NEXT_RSPACK
+
 describe('use-cache-segment-configs', () => {
   const { next, skipped, isNextDev, isTurbopack } = nextTestSetup({
     files: __dirname,
@@ -74,6 +76,28 @@ describe('use-cache-segment-configs', () => {
              at <unknown> (./app/runtime/page.tsx:1:14)
          "
         `)
+      } else if (isRspack) {
+        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'
+                 │    :              ^^^^^^^
+                 │  2 |
+                 │  3 | export default function Page() {
+                 │  4 |   return <div>This page uses \`export const runtime\`.</div>
+                 │    \`----
+                 │
+               
+         Import trace for requested module:
+         // TODO(veil): Fix broken import trace for Webpack loader resource.
+
+
+         > Build failed because of rspack errors
+         "
+        `)
       } else {
         expect(buildOutput).toMatchInlineSnapshot(`
          "

filename: test/e2e/app-dir/use-cache-unknown-cache-kind/use-cache-unknown-cache-kind.test.ts
patch: @@ -10,7 +10,7 @@ import {
 import stripAnsi from 'strip-ansi'
 import { createSandbox } from 'development-sandbox'
 
-const isRspack = process.env.NEXT_RSPACK
+const isRspack = !!process.env.NEXT_RSPACK
 
 const nextConfigWithCacheHandler: NextConfig = {
   experimental: {
@@ -64,7 +64,7 @@ describe('use-cache-unknown-cache-kind', () => {
          ./app/page.tsx
            × Module build failed:
            ╰─▶   × Error:   x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
-                 │   |
+                 │
                  │    ,-[1:1]
                  │  1 | 'use cache: custom'
                  │    : ^^^^^^^^^^^^^^^^^^^

filename: test/e2e/app-dir/use-cache-without-experimental-flag/use-cache-without-experimental-flag.test.ts
patch: @@ -13,7 +13,7 @@ const nextConfigWithUseCache: NextConfig = {
   experimental: { useCache: true },
 }
 
-const isRspack = process.env.NEXT_RSPACK !== undefined
+const isRspack = !!process.env.NEXT_RSPACK
 
 describe('use-cache-without-experimental-flag', () => {
   const { next, isNextStart, isTurbopack, skipped } = nextTestSetup({
@@ -51,6 +51,31 @@ describe('use-cache-without-experimental-flag', () => {
              at <unknown> (./app/page.tsx:1:1)
          "
         `)
+      } else if (isRspack) {
+        expect(buildOutput).toMatchInlineSnapshot(`
+         "
+         ./app/page.tsx
+           × Module build failed:
+           ╰─▶   × Error:   x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
+                 │   |
+                 │   | Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
+                 │
+                 │    ,-[1:1]
+                 │  1 | 'use cache'
+                 │    : ^^^^^^^^^^^
+                 │  2 |
+                 │  3 | export default async function Page() {
+                 │  4 |   return <p>hello world</p>
+                 │    \`----
+                 │
+               
+         Import trace for requested module:
+         ./app/page.tsx
+
+
+         > Build failed because of rspack errors
+         "
+        `)
       } else {
         expect(buildOutput).toMatchInlineSnapshot(`
          "

filename: test/integration/css-minify/test/index.test.js
patch: @@ -20,7 +20,7 @@ function runTests() {
     const $ = cheerio.load(html)
     const href = $('link[rel="preload"]').attr('href')
     const css = await renderViaHTTP(appPort, href)
-    if (process.env.IS_TURBOPACK_TEST) {
+    if (process.env.IS_TURBOPACK_TEST || process.env.NEXT_RSPACK) {
       expect(css).toContain(
         '.a{--var-1:-50%;--var-2:-50%}.b{--var-1:0;--var-2:-50%}'
       )