In some cases (this naming might be a likely scenario in a monorepo containing multiple framework packages), when a project directory's name either matches next or ends with next (eg.: foo-next) and there is an import like dist/{server,shared}, the dev/build server will crash.
I tried adjusting the relevant regex, but I'm not able to capture both cases at the same time without failing on either of the cases. The trickier one is when the folder name is just next.
Fixes #34000
Bug
- [ ] Related issues linked using
fixes #number
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see
contributing.md
Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using
fixes #number
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see
contributing.md
Documentation / Examples
- [ ] Make sure the linting passes by running
yarn lint
Failing test suites
Commit: cb86b5f827643abdf44f2a13ae81ff4f38ef356f
yarn testheadless test/integration/ends-with-next/next/test/index.test.js
- Containing folder name is "next" > dev mode > Has correct initial ref values
- Containing folder name is "next" > production mode > Has correct initial ref values
Expand output
● Containing folder name is "next" › production mode › Has correct initial ref values
FetchError: invalid json response body at http://localhost:37207/api/server reason: Unexpected token I in JSON at position 0
18 | it('Has correct initial ref values', async () => {
19 | const res = await fetchViaHTTP(appPort, '/api/server')
> 20 | expect(await res.json()).toBe(true)
| ^
21 | })
22 | }
23 |
at ../node_modules/node-fetch/lib/index.js:273:32
at Object.<anonymous> (integration/ends-with-next/next/test/index.test.js:20:12)
● Containing folder name is "next" › dev mode › Has correct initial ref values
FetchError: invalid json response body at http://localhost:32779/api/server reason: Unexpected token < in JSON at position 0
18 | it('Has correct initial ref values', async () => {
19 | const res = await fetchViaHTTP(appPort, '/api/server')
> 20 | expect(await res.json()).toBe(true)
| ^
21 | })
22 | }
23 |
at ../node_modules/node-fetch/lib/index.js:273:32
at Object.<anonymous> (integration/ends-with-next/next/test/index.test.js:20:12)
Read more about building and testing Next.js in contributing.md.
Feb 14
'22 21:02
ijjk
Stats from current PR
Default Build (Increase detected ⚠️)
General Overall decrease ✓
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| buildDuration |
15s |
14.9s |
-173ms |
| buildDurationCached |
5.9s |
5.9s |
-15ms |
| nodeModulesSize |
359 MB |
359 MB |
-3 B |
Page Load Tests Overall increase ✓
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| / failed reqs |
0 |
0 |
✓ |
| / total time (seconds) |
2.973 |
2.972 |
0 |
| / avg req/sec |
840.97 |
841.17 |
+0.2 |
| /error-in-render failed reqs |
0 |
0 |
✓ |
| /error-in-render total time (seconds) |
1.158 |
1.153 |
0 |
| /error-in-render avg req/sec |
2158.68 |
2168.22 |
+9.54 |
Client Bundles (main, webpack, commons)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| 450.HASH.js gzip |
179 B |
179 B |
✓ |
| framework-HASH.js gzip |
42 kB |
42 kB |
✓ |
| main-HASH.js gzip |
27.9 kB |
27.9 kB |
✓ |
| webpack-HASH.js gzip |
1.44 kB |
1.44 kB |
✓ |
| Overall change |
71.5 kB |
71.5 kB |
✓ |
Legacy Client Bundles (polyfills)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| polyfills-HASH.js gzip |
31 kB |
31 kB |
✓ |
| Overall change |
31 kB |
31 kB |
✓ |
Client Pages
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _app-HASH.js gzip |
1.36 kB |
1.36 kB |
✓ |
| _error-HASH.js gzip |
194 B |
194 B |
✓ |
| amp-HASH.js gzip |
312 B |
312 B |
✓ |
| css-HASH.js gzip |
326 B |
326 B |
✓ |
| dynamic-HASH.js gzip |
2.57 kB |
2.57 kB |
✓ |
| head-HASH.js gzip |
350 B |
350 B |
✓ |
| hooks-HASH.js gzip |
919 B |
919 B |
✓ |
| image-HASH.js gzip |
5.01 kB |
5.01 kB |
✓ |
| index-HASH.js gzip |
263 B |
263 B |
✓ |
| link-HASH.js gzip |
2.26 kB |
2.26 kB |
✓ |
| routerDirect..HASH.js gzip |
321 B |
321 B |
✓ |
| script-HASH.js gzip |
383 B |
383 B |
✓ |
| withRouter-HASH.js gzip |
318 B |
318 B |
✓ |
| 85e02e95b279..7e3.css gzip |
107 B |
107 B |
✓ |
| Overall change |
14.7 kB |
14.7 kB |
✓ |
Client Build Manifests
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _buildManifest.js gzip |
459 B |
459 B |
✓ |
| Overall change |
459 B |
459 B |
✓ |
Rendered Page Sizes
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| index.html gzip |
532 B |
532 B |
✓ |
| link.html gzip |
545 B |
545 B |
✓ |
| withRouter.html gzip |
526 B |
526 B |
✓ |
| Overall change |
1.6 kB |
1.6 kB |
✓ |
Default Build with SWC (Increase detected ⚠️)
General Overall decrease ✓
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| buildDuration |
18.5s |
18.4s |
-95ms |
| buildDurationCached |
5.8s |
6.1s |
⚠️ +234ms |
| nodeModulesSize |
359 MB |
359 MB |
-3 B |
Page Load Tests Overall increase ✓
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| / failed reqs |
0 |
0 |
✓ |
| / total time (seconds) |
2.952 |
2.971 |
⚠️ +0.02 |
| / avg req/sec |
846.88 |
841.57 |
⚠️ -5.31 |
| /error-in-render failed reqs |
0 |
0 |
✓ |
| /error-in-render total time (seconds) |
1.163 |
1.153 |
-0.01 |
| /error-in-render avg req/sec |
2148.89 |
2168.09 |
+19.2 |
Client Bundles (main, webpack, commons)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| 450.HASH.js gzip |
179 B |
179 B |
✓ |
| framework-HASH.js gzip |
42.1 kB |
42.1 kB |
✓ |
| main-HASH.js gzip |
27.9 kB |
27.9 kB |
✓ |
| webpack-HASH.js gzip |
1.44 kB |
1.44 kB |
✓ |
| Overall change |
71.6 kB |
71.6 kB |
✓ |
Legacy Client Bundles (polyfills)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| polyfills-HASH.js gzip |
31 kB |
31 kB |
✓ |
| Overall change |
31 kB |
31 kB |
✓ |
Client Pages
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _app-HASH.js gzip |
1.35 kB |
1.35 kB |
✓ |
| _error-HASH.js gzip |
180 B |
180 B |
✓ |
| amp-HASH.js gzip |
305 B |
305 B |
✓ |
| css-HASH.js gzip |
321 B |
321 B |
✓ |
| dynamic-HASH.js gzip |
2.56 kB |
2.56 kB |
✓ |
| head-HASH.js gzip |
342 B |
342 B |
✓ |
| hooks-HASH.js gzip |
911 B |
911 B |
✓ |
| image-HASH.js gzip |
5.05 kB |
5.05 kB |
✓ |
| index-HASH.js gzip |
256 B |
256 B |
✓ |
| link-HASH.js gzip |
2.28 kB |
2.28 kB |
✓ |
| routerDirect..HASH.js gzip |
314 B |
314 B |
✓ |
| script-HASH.js gzip |
375 B |
375 B |
✓ |
| withRouter-HASH.js gzip |
309 B |
309 B |
✓ |
| 85e02e95b279..7e3.css gzip |
107 B |
107 B |
✓ |
| Overall change |
14.7 kB |
14.7 kB |
✓ |
Client Build Manifests
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _buildManifest.js gzip |
458 B |
458 B |
✓ |
| Overall change |
458 B |
458 B |
✓ |
Rendered Page Sizes
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| index.html gzip |
533 B |
533 B |
✓ |
| link.html gzip |
546 B |
546 B |
✓ |
| withRouter.html gzip |
527 B |
527 B |
✓ |
| Overall change |
1.61 kB |
1.61 kB |
✓ |
Commit: cb86b5f827643abdf44f2a13ae81ff4f38ef356f
Feb 14
'22 21:02
ijjk
Failing test suites
Commit: 23efac094af097341a0efe10d5628ee919f5e220
yarn testheadless test/integration/ends-with-next/next/test/index.test.js
- Containing folder name is "next" > dev mode > Does not crash on API call including import
- Containing folder name is "next" > production mode > Does not crash on API call including import
Expand output
● Containing folder name is "next" › production mode › Does not crash on API call including import
FetchError: invalid json response body at http://localhost:40471/api/server reason: Unexpected token I in JSON at position 0
18 | it('Does not crash on API call including import', async () => {
19 | const res = await fetchViaHTTP(appPort, '/api/server')
> 20 | expect(await res.json()).toBe(true)
| ^
21 | })
22 | }
23 |
at ../node_modules/node-fetch/lib/index.js:273:32
at Object.<anonymous> (integration/ends-with-next/next/test/index.test.js:20:12)
● Containing folder name is "next" › dev mode › Does not crash on API call including import
FetchError: invalid json response body at http://localhost:43795/api/server reason: Unexpected token < in JSON at position 0
18 | it('Does not crash on API call including import', async () => {
19 | const res = await fetchViaHTTP(appPort, '/api/server')
> 20 | expect(await res.json()).toBe(true)
| ^
21 | })
22 | }
23 |
at ../node_modules/node-fetch/lib/index.js:273:32
at Object.<anonymous> (integration/ends-with-next/next/test/index.test.js:20:12)
Read more about building and testing Next.js in contributing.md.
Feb 14
'22 22:02
ijjk
Stats from current PR
Default Build (Decrease detected ✓)
General Overall increase ⚠️
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| buildDuration |
20.6s |
20.5s |
-68ms |
| buildDurationCached |
7.7s |
7.6s |
-112ms |
| nodeModulesSize |
359 MB |
359 MB |
⚠️ +18 B |
Page Load Tests Overall decrease ⚠️
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| / failed reqs |
0 |
0 |
✓ |
| / total time (seconds) |
4.307 |
4.372 |
⚠️ +0.06 |
| / avg req/sec |
580.44 |
571.87 |
⚠️ -8.57 |
| /error-in-render failed reqs |
0 |
0 |
✓ |
| /error-in-render total time (seconds) |
1.99 |
2.137 |
⚠️ +0.15 |
| /error-in-render avg req/sec |
1256.39 |
1170.07 |
⚠️ -86.32 |
Client Bundles (main, webpack, commons)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| 450.HASH.js gzip |
179 B |
179 B |
✓ |
| framework-HASH.js gzip |
42 kB |
42 kB |
✓ |
| main-HASH.js gzip |
27.9 kB |
27.9 kB |
✓ |
| webpack-HASH.js gzip |
1.44 kB |
1.44 kB |
✓ |
| Overall change |
71.5 kB |
71.5 kB |
✓ |
Legacy Client Bundles (polyfills)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| polyfills-HASH.js gzip |
31 kB |
31 kB |
✓ |
| Overall change |
31 kB |
31 kB |
✓ |
Client Pages
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _app-HASH.js gzip |
1.36 kB |
1.36 kB |
✓ |
| _error-HASH.js gzip |
194 B |
194 B |
✓ |
| amp-HASH.js gzip |
312 B |
312 B |
✓ |
| css-HASH.js gzip |
326 B |
326 B |
✓ |
| dynamic-HASH.js gzip |
2.57 kB |
2.57 kB |
✓ |
| head-HASH.js gzip |
350 B |
350 B |
✓ |
| hooks-HASH.js gzip |
919 B |
919 B |
✓ |
| image-HASH.js gzip |
5.01 kB |
5.01 kB |
✓ |
| index-HASH.js gzip |
263 B |
263 B |
✓ |
| link-HASH.js gzip |
2.26 kB |
2.26 kB |
✓ |
| routerDirect..HASH.js gzip |
321 B |
321 B |
✓ |
| script-HASH.js gzip |
383 B |
383 B |
✓ |
| withRouter-HASH.js gzip |
318 B |
318 B |
✓ |
| 85e02e95b279..7e3.css gzip |
107 B |
107 B |
✓ |
| Overall change |
14.7 kB |
14.7 kB |
✓ |
Client Build Manifests
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _buildManifest.js gzip |
459 B |
459 B |
✓ |
| Overall change |
459 B |
459 B |
✓ |
Rendered Page Sizes
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| index.html gzip |
532 B |
532 B |
✓ |
| link.html gzip |
545 B |
545 B |
✓ |
| withRouter.html gzip |
526 B |
526 B |
✓ |
| Overall change |
1.6 kB |
1.6 kB |
✓ |
Default Build with SWC (Increase detected ⚠️)
General Overall increase ⚠️
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| buildDuration |
25.4s |
25s |
-377ms |
| buildDurationCached |
7.9s |
7.9s |
⚠️ +58ms |
| nodeModulesSize |
359 MB |
359 MB |
⚠️ +18 B |
Page Load Tests Overall increase ✓
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| / failed reqs |
0 |
0 |
✓ |
| / total time (seconds) |
4.509 |
4.529 |
⚠️ +0.02 |
| / avg req/sec |
554.42 |
552 |
⚠️ -2.42 |
| /error-in-render failed reqs |
0 |
0 |
✓ |
| /error-in-render total time (seconds) |
2.084 |
2.062 |
-0.02 |
| /error-in-render avg req/sec |
1199.83 |
1212.27 |
+12.44 |
Client Bundles (main, webpack, commons)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| 450.HASH.js gzip |
179 B |
179 B |
✓ |
| framework-HASH.js gzip |
42.1 kB |
42.1 kB |
✓ |
| main-HASH.js gzip |
27.9 kB |
27.9 kB |
✓ |
| webpack-HASH.js gzip |
1.44 kB |
1.44 kB |
✓ |
| Overall change |
71.6 kB |
71.6 kB |
✓ |
Legacy Client Bundles (polyfills)
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| polyfills-HASH.js gzip |
31 kB |
31 kB |
✓ |
| Overall change |
31 kB |
31 kB |
✓ |
Client Pages
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _app-HASH.js gzip |
1.35 kB |
1.35 kB |
✓ |
| _error-HASH.js gzip |
180 B |
180 B |
✓ |
| amp-HASH.js gzip |
305 B |
305 B |
✓ |
| css-HASH.js gzip |
321 B |
321 B |
✓ |
| dynamic-HASH.js gzip |
2.56 kB |
2.56 kB |
✓ |
| head-HASH.js gzip |
342 B |
342 B |
✓ |
| hooks-HASH.js gzip |
911 B |
911 B |
✓ |
| image-HASH.js gzip |
5.05 kB |
5.05 kB |
✓ |
| index-HASH.js gzip |
256 B |
256 B |
✓ |
| link-HASH.js gzip |
2.28 kB |
2.28 kB |
✓ |
| routerDirect..HASH.js gzip |
314 B |
314 B |
✓ |
| script-HASH.js gzip |
375 B |
375 B |
✓ |
| withRouter-HASH.js gzip |
309 B |
309 B |
✓ |
| 85e02e95b279..7e3.css gzip |
107 B |
107 B |
✓ |
| Overall change |
14.7 kB |
14.7 kB |
✓ |
Client Build Manifests
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| _buildManifest.js gzip |
458 B |
458 B |
✓ |
| Overall change |
458 B |
458 B |
✓ |
Rendered Page Sizes
|
vercel/next.js canary |
vercel/next.js fix/folder-with-next-suffix |
Change |
| index.html gzip |
533 B |
533 B |
✓ |
| link.html gzip |
546 B |
546 B |
✓ |
| withRouter.html gzip |
527 B |
527 B |
✓ |
| Overall change |
1.61 kB |
1.61 kB |
✓ |
Commit: 23efac094af097341a0efe10d5628ee919f5e220
Feb 14
'22 22:02
ijjk