petehunt / webpack-howto

10.12k stars 697 forks source link

Best practices for depenendencies vs devDependencies #53

Open dustingetz opened 8 years ago

dustingetz commented 8 years ago

Since webpack produces an artifact that bundles all dependencies, none of the dependencies need to be available in the node environment at runtime (because there is no node environment in prod unless we are using node to serve the prod assets), so shouldn't we all be using devDependencies for everything? Is there any reason that we are not doing this or is it just a misleading convention?

dustingetz commented 8 years ago

see http://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies

dustingetz commented 8 years ago

see https://github.com/webpack/webpack/issues/520

whenov commented 8 years ago

IMO the following command should be run in development environment:

NODE_ENV=development npm install
NODE_ENV=production webpack

And the following in production environment, and this is necessary only if you use node.js as the backend:

NODE_ENV=production npm install

You don't need webpack in production environment.