Webpack not found, deploying to Heroku
As others have said, Heroku runs node as production NODE_ENV=production
, which means your devDependencies don't get installed. Heroku provides node specific build hooks though. I use heroku-prebuild
to run npm install --dev
, which installs all dependencies and devDependencies.
"scripts": { ..., "heroku-prebuild": "npm install --dev", ...},
Running your app NOT in production mode should probably be avoided. Often developers have "dev mode" specific code that will get filtered out when running in production. Plus if you're doing things a webpack build you definitely want to be in production mode to take advantage of minification, uglifying, etc.
Here's the details from Heroku.
Sometimes, developers need something more production-oriented than the preinstall and postinstall hooks in package.json. For instance, some apps need to set up extra authentication before installing dependencies. Some need to build assets, but not in a development environment. Further examples can be found in the discussion on GitHub.
Node.js developers can now use heroku-prebuild and heroku-postbuild hooks to tailor the build process to their apps.