Netlify dev + wabpack watch

Hi
I am working on a project and my during my dev process webpack is running with the --watch flag (which means that the task is running in the foreground).
I have no custom netlify configuration and running a fairy standard webpack build.

I currently use netlify dev in one terminal window and netlify dev:exec webpack --watch in another terminal window, and that works fine.

Is there a way to configure netlify to do this with a single command?

Thanks!

Hi, @uzikilon. I’m not understanding the reason for the netlify dev in the first window. What happens if you don’t run that command and use use netlify dev:exec webpack --watch by itself? (Also, do you happen to have a public repo that reproduces the issue?)

1 Like

Unfortunately, there’s no public repo, but my setup is a generic webpack build with watch mode that listens to changes in the file system.
I need netlify dev in order to run netlify’s http server so I can access the app, functions, aliases, etc.

Hi, @uzikilon. Will you please test this?

 netlify dev -c "webpack --watch"

That one command should work. If it does work, you can also add a [dev] section to netlify.toml. There is documentation about this here:

https://cli.netlify.com/netlify-dev/#netlifytoml-dev-block

With a [dev] section like this:

[dev]
  command = "webpack --watch"

you should be able to run just netlify dev by itself (without the -c "webpack --watch" option).

​Please let us know if this does not work or if there are any questions.