-
Notifications
You must be signed in to change notification settings - Fork 28
fix: support npm run dev (remix dev) and Netlify CLI #95
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
Changes from all commits
b2863f4
c4f855f
2687f2f
e45fd11
b04cccd
d932e0d
acb8567
3f76599
c5b842d
8f92177
d977e56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ node_modules | |
|
||
/.cache | ||
/public/build | ||
/build | ||
.env | ||
|
||
# Local Netlify folder | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"scripts": { | ||
"build": "remix build", | ||
"dev": "remix dev", | ||
"start": "cross-env NODE_ENV=production netlify dev", | ||
"start": "netlify serve", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using ntl serve as it makes more sense in this context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd normally expect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was going with your suggestion from the other day unless I was dreaming. 🙃 . Using serve avoids running build explicitly which is nice and ntl dev still gives us dev mode There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I meant was that if people wanted the previous behaviour (i.e. running the prod server) then they could use ntl serve instead |
||
"typecheck": "tsc -b" | ||
}, | ||
"dependencies": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
const baseConfig = | ||
process.env.NODE_ENV === "production" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll only pull in the custom server settings if building for production, i.e. |
||
? // 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; | ||
|
||
/** @type {import('@remix-run/dev').AppConfig} */ | ||
module.exports = { | ||
serverBuildTarget: "netlify", | ||
server: | ||
process.env.NETLIFY || process.env.NETLIFY_LOCAL | ||
? "./server.js" | ||
: undefined, | ||
...baseConfig, | ||
ignoredRouteFiles: ["**/.*"], | ||
// appDirectory: "app", | ||
// assetsBuildDirectory: "public/build", | ||
// serverBuildPath: ".netlify/functions-internal/server.js", | ||
// publicPath: "/build/", | ||
// add your own custom config here if you want to. | ||
// | ||
// See https://remix.run/docs/en/v1/file-conventions/remix-config | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This template uses this file instead of the typicial Netlify _redirects file. | ||
# For more information about redirects and rewrites, see https://docs.netlify.com/routing/redirects/. | ||
|
||
# Do not remove the line below. This is required to serve the site when deployed. | ||
/\* /.netlify/functions/server 200 | ||
|
||
# Add other redirects and rewrites here and/or in your netlify.toml |
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.
remix dev
generates these artifacts as well as those in/public/build