-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
match next.js client side routing (buildManifest rewrites & devPagesManifest HMR) #3701
match next.js client side routing (buildManifest rewrites & devPagesManifest HMR) #3701
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
|
@@ -13,6 +14,12 @@ const loadNextConfig = async (silent) => { | |||
|
|||
nextConfig.generateBuildId = await nextConfig.generateBuildId?.(); | |||
|
|||
const customRoutes = await loadCustomRoutes(nextConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be creating this on the Next.js side so that we don't have to call loadCustomRoutes
twice x-ref: https://github.com/vercel/next.js/blob/7654d7bc2d95c8b3dc18cf5e94695375c733e74c/packages/next/src/server/lib/route-resolver.ts#L28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We load the whole config a second time to call the route resolver right now unfortunately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijjk is there any chance we could get something implemented on the next.js side that would allow the whole config to be serialized to JSON (after loading custom routes probably)?
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct Redirect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to implement all of these if we only care about Rewrite
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not 🤷♀️
But maybe we can pass the serialized version to the next.js router
468dc29
to
e802dbc
Compare
ba9e259
to
e9294f2
Compare
CatchAll, | ||
} | ||
|
||
impl From<&str> for PageSortKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can bound the lifetime of PageSortKey
by the &str
, so we don't need to clone into a String
?
impl From<&str> for PageSortKey { | |
impl<'a> From<&'a str> for PageSortKey<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was assuming the &str
wouldn't survive after returning out of the sort_by_cached_key
lambda function, but let me check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
error: lifetime may not live long enough
--> crates\next-core\src\manifest.rs:77:39
|
77 | routes.sort_by_cached_key(|s| s.split('/').map(PageSortKey::from).collect::<Vec<_>>());
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is Vec<PageSortKey<'2>>
| has type `&'1 std::string::String`
Benchmark for 6eab4b9
Click to view full benchmark
|
…49736102+kodiakhq[bot]@users.noreply.github.com> # New Features - vercel/turborepo#3540 - vercel/turborepo#3549 - vercel/turborepo#3465 - vercel/turborepo#3550 - vercel/turborepo#3495 - vercel/turborepo#3624 - vercel/turborepo#3600 - vercel/turborepo#3676 - vercel/turborepo#3689 # Fixes - vercel/turborepo#3437 - vercel/turborepo#3542 - vercel/turborepo#3531 - vercel/turborepo#3552 - vercel/turborepo#3551 - vercel/turborepo#3597 - vercel/turborepo#3644 - vercel/turborepo#3623 - vercel/turborepo#3634 - vercel/turborepo#3574 - vercel/turborepo#3673 - vercel/turborepo#3675 - vercel/turborepo#3723 - vercel/turborepo#3677 - vercel/turborepo#3717 - vercel/turborepo#3701 # Performance Improvements - vercel/turborepo#3361 - vercel/turborepo#3619 --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
No description provided.