-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from netlify/v2
feat!: update to Remix 2
- Loading branch information
Showing
18 changed files
with
130 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
export default { | ||
extends: ["@remix-run/eslint-config", "@remix-run/eslint-config/node"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1 @@ | ||
import type { EntryContext } from "@remix-run/node"; | ||
import { RemixServer } from "@remix-run/react"; | ||
import { renderToString } from "react-dom/server"; | ||
|
||
export default function handleRequest( | ||
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext | ||
) { | ||
const markup = renderToString( | ||
<RemixServer context={remixContext} url={request.url} /> | ||
); | ||
|
||
responseHeaders.set("Content-Type", "text/html"); | ||
|
||
return new Response("<!DOCTYPE html>" + markup, { | ||
headers: responseHeaders, | ||
status: responseStatusCode, | ||
}); | ||
} | ||
export { handleRequest as default } from "@netlify/remix-adapter"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
const baseConfig = | ||
process.env.NODE_ENV === "production" | ||
? // when running the Netify CLI or building on Netlify, we want to use | ||
{ | ||
server: "./server.js", | ||
serverBuildPath: ".netlify/functions-internal/server.js", | ||
} | ||
: // otherwise support running remix dev, i.e. no custom server | ||
undefined; | ||
import { config } from "@netlify/remix-adapter"; | ||
|
||
/** @type {import('@remix-run/dev').AppConfig} */ | ||
module.exports = { | ||
...baseConfig, | ||
ignoredRouteFiles: ["**/.*"], | ||
// See https://remix.run/docs/en/main/file-conventions/route-files-v2 | ||
future: { | ||
v2_routeConvention: true, | ||
} | ||
export default { | ||
...(process.env.NODE_ENV === "production" ? config : undefined), | ||
// This works out of the box with the Netlify adapter, but you can | ||
// add your own custom config here if you want to. | ||
// | ||
// See https://remix.run/docs/en/v1/file-conventions/remix-config | ||
// See https://remix.run/file-conventions/remix-config | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1 @@ | ||
import type { EntryContext } from "@remix-run/node"; | ||
import { RemixServer } from "@remix-run/react"; | ||
// Looking to use renderReadableStream? See https://github.com/netlify/remix-template/discussions/100 | ||
import { renderToString } from "react-dom/server"; | ||
|
||
export default function handleRequest( | ||
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext | ||
) { | ||
const markup = renderToString( | ||
<RemixServer context={remixContext} url={request.url} /> | ||
); | ||
|
||
responseHeaders.set("Content-Type", "text/html"); | ||
|
||
return new Response("<!DOCTYPE html>" + markup, { | ||
headers: responseHeaders, | ||
status: responseStatusCode, | ||
}); | ||
} | ||
export { handleRequest as default } from "@netlify/remix-edge-adapter"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.