-
Notifications
You must be signed in to change notification settings - Fork 10
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!: upgrade to Remix 2 #191
Conversation
✅ Deploy Preview for remix-serverless ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This comment was marked as outdated.
This comment was marked as outdated.
✅ Deploy Preview for remix-edge ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
80e3fa6
to
5a9314e
Compare
- name: Run unit tests | ||
run: npm test |
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.
These were just the Netlify adapter tests ported from Remix repo. See below for why they were removed.
{ | ||
"extends": ["@remix-run/eslint-config", "@remix-run/eslint-config/node"], | ||
} |
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.
Changed to json because of ESM
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.
ESLint v9 is going to remove support for JSON .eslintrc
files
@@ -1,10 +1,17 @@ | |||
import * as build from '@remix-run/dev/server-build' | |||
import { createRequestHandler } from '@netlify/remix-adapter' | |||
import { installGlobals } from '@remix-run/node' |
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 don't want to use Remix versions of web streams
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext, | ||
loadContext: AppLoadContext, | ||
) { | ||
const markup = renderToString(<RemixServer context={remixContext} url={request.url} />) | ||
const body = await renderToReadableStream(<RemixServer context={remixContext} url={request.url} />, { |
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.
Streaming works now
// Avoid a bug where responses aren't flushed if there's an outstanding timer. | ||
clearTimeout(timer) |
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.
ignoredRouteFiles: ['**/.*'], | ||
server: process.env.NETLIFY || process.env.NETLIFY_LOCAL ? './server.ts' : undefined, |
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 can now use our custom server in dev
@@ -1,25 +1,30 @@ | |||
/** | |||
* By default, Remix will handle generating the HTTP Response for you. | |||
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ |
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 true!
"scripts": { | ||
"prebuild": "cd ../../ && npm run build -w=packages/remix-runtime && npm run build -w=packages/remix-edge-adapter && npm run build -w=packages/remix-adapter", | ||
"build": "remix build", | ||
"dev": "remix watch", | ||
"dev": "remix dev --manual -c \"ntl dev --framework=#static\"", |
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 remix server now runs the netlify CLI rather than the other way around
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.
These tests were all for the workarounds that translated the Remix responses into Netlify/Lambda-compatible ones. These are no longer needed with Functions v2, because we can return the Reponse directly
packages/remix-adapter/src/server.ts
Outdated
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 is now effectively the same as the edge server
This site no longer exists. I've disabled builds. |
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.
Seems good - need to resolve package-lock.json
conflict and will have to re-approve after that
Description
Update adapters and edge runtime to Remix 2, and to Functions API v2. Switches to using our custom server during dev in edge, now that there's better support for this. Moves everything to ESM now that's required.
There is a separate PR to update the template once this is out.
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes
For us to review and ship your PR efficiently, please perform the following steps:
ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a
typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
guide and passes our tests.
A picture of a cute animal (not mandatory, but encouraged)