You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect webpack to be in dependencies not devDependencies, because if it's in devDependencies, then it won't be used in production.
But if I don't have webpack in production, I cannot serve the asset, and our app won't work properly.
Why is webpack in devDependencies?
Also, do people simply use npm run bundle -- -p to run webpack in production? How do they handle asset file change? Do they need to stop webpack and re-run npm run bundle -- -p? Do they have to manually login to server, find the pid of webpack by using ps and use kill -9 to kill it?
The text was updated successfully, but these errors were encountered:
On the production server, asset files should not change. They only need to be compiled once, during deployment. Therefore, you do not need to have a webpack process running on the server.
Webpack should only need to be run once, during deploy. This will create the static asset files in the public directory, which should then be served by your server software (likely NGINX or Apache).
The question of whether to put webpack in devDependencies or dependencies is therefore mostly academic, and shouldn't have any significant impact on your project.
I expect webpack to be in
dependencies
notdevDependencies
, because if it's indevDependencies
, then it won't be used in production.But if I don't have webpack in production, I cannot serve the asset, and our app won't work properly.
Why is webpack in
devDependencies
?Also, do people simply use
npm run bundle -- -p
to run webpack in production? How do they handle asset file change? Do they need to stop webpack and re-runnpm run bundle -- -p
? Do they have to manually login to server, find the pid of webpack by usingps
and usekill -9
to kill it?The text was updated successfully, but these errors were encountered: