cli
cli copied to clipboard
Add `netlify serve` command
Is your feature request related to a problem? Please describe.
Currently the dev command is used to run the framework's dev command, but this is usually not the same as the production site.
Describe the solution you'd like
A serve command that does the following:
- By default, runs the build command and uses the config modified by the build plugins. This can be disabled with
--no-build - Runs the static server and functions server, in the same way as
--framework=#static
Describe alternatives you've considered
Running ntl deploy --build, killing the process once the modified toml has been created, then running ntl dev --framework=#static
Additional context
Would work well alongside #3906, in which case it could skip building by default and instead have a --build flag like deploy.
Can you submit a pull request?
Yes
Pull requests are welcome! If you would like to help us add this feature, please check our contributions guidelines.
Thanks @ascorbic, to add to it, we'll probably want to re-run build on changes to source files.
To add a use-case here, there is currently no way to locally test if Netlify redirects are working correctly when using gatsby-plugin-netlify, as those are only generated at build time. Having this would be really helpful for debugging!