Netlify dev command is using build and not reloading?

I’m trying to use the netlify dev command to run my app in development mode with the ability to use my Netlify functions.

The command kind of works, and I can use my Netlify function, but the problem is that the command seems to always use my last build instead of showing me the live dev version.

I’m using the Quasar framework, and I’ve specified the [dev] command within netlify.toml. I’ve tried quasar dev and I’ve also tried npm run dev (ensuring the dev script runs quasar dev).

When I run netlify dev, something strange happens. Netlify starts up a server on port 8888, then it runs quasar dev which starts up its own server on port 9000. So there are effectively two local dev servers started with the command. That’s fine, but the major problem is that they are not the same. The local dev server that starts on port 8888 seems to always go to my last build, (not rebuilding from source) whereas the quasar dev server on 9000 is using my current source.

So I can run netlify dev, which starts these 2 dev servers, and each one can display something totally different. If I edit a code file and save, the dev server on 9000 updates but the one on 8888 does not. If I stop netlify and run the netlify dev command again, the server on 8888 will STILL not show my updates. I have to run npm run build // quasar build command for netlify dev to show the latest version.

Update: I noticed that when running the command it says “No app server detected” and seems to start a sever using the build:

image

I think I have it working now. I had to add the targetPort, port, and publish settings to the [dev] setion of my netlify.toml file to get it to work. With only the command setting, it didn’t work.

[dev]
  command = "npm run dev"
  targetPort = 9000
  port = 8888
  publish = "dist"
1 Like

Thanks for coming back and sharing! This is very useful for future folks who encounter the same obstacle.

Happy building :rocket:

1 Like