-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
fix: use vercel routing utils #525
Conversation
🦋 Changeset detectedLatest commit: 2852086 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
!preview vercel-routing |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
assert.notEqual(blogRoute, undefined); | ||
assert.equal(blogRoute.headers.Location.startsWith('/team/articles'), true); | ||
assert.equal(blogRoute.status, 301); | ||
}); | ||
|
||
it('define trailingSlash redirect for sub pages', async () => { |
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.
Removed because this isn't how they're done now: it's a global thing instead
!preview vercel-routing |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
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.
It looks good code-wise, however it would be great to address some unclear points of the code with some comment
Just tried upgrading to this version and now I'm getting a crash with the error: |
Vercel broke this at https://github.com/vercel/vercel/pull/12962/files#r1943717873 |
Changes
This updates the Vercel adapter to use the
@vercel/routing-utils
to generate redirect routes, rather than building them ourselves. Instead we generate the redirects in the hgher-level path-to-regexp syntax, which we then pass togetTransformedRoutes
. This has the benefit of automatically handling trailing slash redirects and various Vercel edge cases.We also now validate and normalise the generated routes using
normalizeRoutes
.This also adds an error message for conflicting config if the user has conflicting
trailingSlash
set in the Vercel config. There is no reason to use it in thevercel.json
now, because the adapter does the same thing.Fixes #418
Fix #499
Testing
Docs