-
Notifications
You must be signed in to change notification settings - Fork 13
fix(@netlify/vite-plugin-react-router): fix local dev with edge: true
#572
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
Conversation
✅ Deploy Preview for remix-edge ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for remix-serverless ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
edge: trueedge: true
edge: trueedge: true
c0c34b0 to
4bb55b6
Compare
| "@netlify/edge-functions": "^3.0.2", | ||
| "@netlify/functions": "^5.1.0", |
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.
Not completely related, but these shouldn't be dev deps anymore, since they're needed for the netlifyRouterContext export added in 2.0.0.
4bb55b6 to
f255a7d
Compare
because why not
These are now needed at runtime when importing `netlifyRouterContext`.
There's some more sophisticated solution involving the Vite Environment API down the line, but for now I just ported something very similar to what we do for Remix: have users write a one-liner server entry to uses our Vite virtual module that conditionally resolves depending on build (edge entry) vs. dev (node.js entry). As a bonus, the file for users to copy is a single line instead of 40.
f255a7d to
018f127
Compare
Description
Follow-up to #562. It turns out
react-router devdoes not work with the new edge mode as documented. This is because React Router uses the user's server entry file, which is intentionally intended for an edge runtime, and unfortunately incompatible with a Node.js runtime, which it uses in dev.There's some more sophisticated solution involving the Vite Environment API we can look into down the line, but for now I just ported something very similar to what we do for Remix: have users write a one-liner server entry that uses our Vite virtual module that conditionally resolves depending on build (edge entry) vs. dev (node.js entry).
As a bonus, the file for users to copy is a single line instead of 40 🎉.