I started a Remix tutorial from this link
Basically just ran
npx create-remix@latest
And followed the instructions.
Now in my package.json I see:
"scripts": {
"build": "remix vite:build",
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location
./node_modules/.cache/eslint .",
"start": "remix-serve ./build/server/index.js",
"typecheck": "tsc"
},
I know Vite well, so I understand the dev
command, as starting a dev server.
I'd like to know as a Remix newbie (couldn't find a simple answer in the docs):
What is the purpose of the start
command, and its relation to the dev
command?
The start
command starts serving your build from ./build directory using a built-in Remix App Server.
That build should be previously created with the build
command.
So the purpose is to run a (production) build.
Remix encourages you to bring your own server, e.g. Express or whatever you prefer. Then you could modify the start
command as follows:
"start": "cross-env NODE_ENV=production node ./build/server/index.js"