-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat(netlify): use new @netlify/vite-plugin-react-router #40
base: main
Are you sure you want to change the base?
Conversation
# Set immutable caching for static files, because they have fingerprinted filenames | ||
|
||
[[headers]] | ||
for = "/assets/*" | ||
[headers.values] | ||
"Cache-Control" = "public, max-age=31560000, immutable" |
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.
This isn't needed, since these assets are in the publish dir (build/client
) and uploaded to the CDN at deploy time and served statically
I get this error
|
e3735ef
to
dedf7c7
Compare
Thank you @TrySound! It looks like I went a bit overboard with removing unused dependencies. It should be fixed now! |
|
||
export default async (request: Request, context: Context) => { | ||
return requestHandler(request, { | ||
VALUE_FROM_NETLIFY: "Hello from Netlify", |
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.
VALUE_FROM_NETLIFY
is still referenced in app/routes/home.tsx
, but now that the server app file has been removed that context isn't getting set anywhere. Part of the value proposition with React Router framework is that it produced a request handler that can be plugged into any server.
With the new approach you are proposing here, how would I define load context like VALUE_FROM_NETLIFY
?
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.
The Vite plugin merges the Netlify function context with the app load context (this is copied pretty much as-is from our Remix plugin). You can also see e2e test coverage of this here.
I could be misunderstanding though! Can you give a more concrete example of what a user would be trying to accomplish here?
See https://github.com/netlify/remix-compute/tree/main/packages/vite-plugin-react-router.
This removes all the custom Netlify stuff from the template except the
netlify.toml
and the Vite plugin. 🎉