christianalfoni / webpack-express-boilerplate

A boilerplate for running a Webpack workflow in Node express
MIT License
1.39k stars 291 forks source link

Only require devDependencies when NODE_ENV is not production #81

Open jmorrell opened 6 years ago

jmorrell commented 6 years ago

Fixes #66

When NODE_ENV=production by default npm will not install devDependencies, and it is considered a best practice to not deploy your application with any devDependencies installed, otherwise they are direct dependencies of your application.

However if you try to do that with this boilerplate it will crash since it requires webpack and related tools even in production. This PR moves those requires behind the conditional and relocates express to dependencies since it's required at both build time and in production.