Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mehalubozo's avatar

What is the difference between npm run dev and npm run production?

I have all these commands that I can run for my frontend but I don't understand the difference. When do I run what and can I always run them?

0 likes
2 replies
bobbybouwmann's avatar
Level 88

I think this is a very valid question to ask.

As far as I understand it npm run dev will compile all your assets including a source map. This basically makes it easier to inspect any errors in the developer tools in the console in your browser. If you open up the public/css/app.css file for example you can see that everything is in one file but not minified.

Now if you run npm run production it will actually minify everything and not create a source map for the files. However since it's modified the files are smaller and harder to read.

In general you run npm run dev locally and npm run production before you deploy your application. This can either be done locally before committing or during your deployment.

3 likes
jlrdw's avatar

But it is in the documentation and there is a video covering the difference.

But yeah production makes assets production ready.

Please or to participate in this conversation.