petehunt/webpack-howto

Best practices for depenendencies vs devDependencies

Opened this issue ยท 3 comments

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?

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.