Node.js deploys will run "build" script automatically beginning March 11
Change effective on 11 February 2019
Beginning March 11. 2019, Node.js deployments will automatically execute an app’s build
script during build if one is defined in the app’s package.json
file:
"scripts": {
"start": "node src/index.js",
"build": "webpack" // This command will automatically run on deployment
}
If a heroku-postbuild
script is also defined, it will be run instead of the build
script.
You can opt in to this change any time before March 11 by setting the heroku-run-build-script
key in your package.json
file. Opting in now helps prevent any potential disruption to your workflow when this change rolls out.
...
"scripts": {
"start": "node src/index.js",
"build": "webpack"
},
"heroku-run-build-script": true
To assist with this change, Heroku provides an npm package that updates your package.json
file for you. You can run it with one command in your app’s root directory:
$ npx @heroku/update-node-build-script
For more information, please see the FAQ.