File size: 3,696 Bytes
94786da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts b/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts
new file mode 100644
index 0000000000000000000000000000000000000000..309e3e197d231f2a9ea60926a67b9c6456c65b56
--- /dev/null
+++ b/test/production/debug-build-path/fixtures/default/app/robots.metadata.ts
@@ -0,0 +1,8 @@
+export default function robots() {
+  return {
+    rules: {
+      userAgent: '*',
+      allow: '/',
+    },
+  }
+}
diff --git a/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts b/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7d37bfe091ebf1a2c2cbc1d9e32ea654acbb39c8
--- /dev/null
+++ b/test/production/debug-build-path/fixtures/default/app/sitemap.metadata.ts
@@ -0,0 +1,3 @@
+export default function sitemap() {
+  return [{ url: 'https://example.com' }]
+}
diff --git a/test/production/debug-build-path/fixtures/default/next.config.js b/test/production/debug-build-path/fixtures/default/next.config.js
index 767719fc4fba59345ae29e29159c9aff270f5819..af7a39f7888845358a628ac3f0e2e2a2130754de 100644
--- a/test/production/debug-build-path/fixtures/default/next.config.js
+++ b/test/production/debug-build-path/fixtures/default/next.config.js
@@ -1,4 +1,6 @@
 /** @type {import('next').NextConfig} */
-const nextConfig = {}
+const nextConfig = {
+  pageExtensions: ['metadata.ts', 'js', 'jsx', 'ts', 'tsx'],
+}
 
 module.exports = nextConfig
diff --git a/test/production/debug-build-path/metadata-routes.test.ts b/test/production/debug-build-path/metadata-routes.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..eb06963fafb3fc74463da0c1a352da5628d0a884
--- /dev/null
+++ b/test/production/debug-build-path/metadata-routes.test.ts
@@ -0,0 +1,26 @@
+import path from 'path'
+import { nextTestSetup } from 'e2e-utils'
+
+describe('debug-build-paths metadata routes', () => {
+  const { next } = nextTestSetup({
+    files: path.join(__dirname, 'fixtures/default'),
+    skipStart: true,
+    env: {
+      __NEXT_PRIVATE_DETERMINISTIC_BUILD_OUTPUT: '1',
+    },
+  })
+
+  it('selectively builds App Router metadata routes', async () => {
+    const result = await next.build({
+      args: [
+        '--debug-build-paths',
+        'app/robots.metadata.ts,app/sitemap.metadata.ts',
+      ],
+    })
+
+    expect(result.exitCode).toBe(0)
+    expect(result.cliOutput).toContain('/robots.txt')
+    expect(result.cliOutput).toContain('/sitemap.xml')
+    expect(result.cliOutput).not.toContain('/about')
+  })
+})
diff --git a/test/production/debug-build-path/page-route.test.ts b/test/production/debug-build-path/page-route.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6febe039083cf070a099aae81574fb70a18a7ee1
--- /dev/null
+++ b/test/production/debug-build-path/page-route.test.ts
@@ -0,0 +1,23 @@
+import path from 'path'
+import { nextTestSetup } from 'e2e-utils'
+
+describe('debug-build-paths page route regression', () => {
+  const { next } = nextTestSetup({
+    files: path.join(__dirname, 'fixtures/default'),
+    skipStart: true,
+    env: {
+      __NEXT_PRIVATE_DETERMINISTIC_BUILD_OUTPUT: '1',
+    },
+  })
+
+  it('continues to selectively build a regular App Router page', async () => {
+    const result = await next.build({
+      args: ['--debug-build-paths', 'app/about/page.tsx'],
+    })
+
+    expect(result.exitCode).toBe(0)
+    expect(result.cliOutput).toContain('/about')
+    expect(result.cliOutput).not.toContain('/robots.txt')
+    expect(result.cliOutput).not.toContain('/sitemap.xml')
+  })
+})