-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(next): do not generate conflicting lambdas when using basePath wi…
…th app router (#10738) When using `basePath` with statically generated routes, the builder currently generates lambdas for the root route that conflict with the prerender functions generated. E.g. if we have `basePath: "test"` and a root route at: `app/page.js`, this is currently the output: ``` test test.rsc test/index test/index.rsc ``` The result is that visiting the deployed app at `/test` renders an incomplete page. On the other hand visiting `/test/index` outputs the expected markup. It seems like the intent is that we want to delete the lambdas that conflict with the prerender functions. I've updated the lambda name generation logic when doing the deleting to line up with how the lambda names are generated initially.
- Loading branch information
Showing
8 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@vercel/next': patch | ||
--- | ||
|
||
Fixes a case where using `basePath` along with static generation would output a lambda that conflicts with the root route. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/next/test/integration/app-router-basepath/app/layout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const Layout = ({ children }) => { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
}; | ||
|
||
export default Layout; |
5 changes: 5 additions & 0 deletions
5
packages/next/test/integration/app-router-basepath/app/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const Home = () => { | ||
return <div>Home</div>; | ||
}; | ||
|
||
export default Home; |
7 changes: 7 additions & 0 deletions
7
packages/next/test/integration/app-router-basepath/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
basePath: '/test', | ||
}; | ||
|
||
module.exports = nextConfig; |
8 changes: 8 additions & 0 deletions
8
packages/next/test/integration/app-router-basepath/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"next": "canary", | ||
"react": "latest", | ||
"react-dom": "latest" | ||
}, | ||
"ignoreNextjsUpdates": true | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/next/test/integration/app-router-basepath/vercel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": 2, | ||
"builds": [{ "src": "package.json", "use": "@vercel/next" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters