I have a Node.js website hosted on Heroku, that I deploy with git. I use several node modules, referenced in package.json; is there a way to prevent Heroku to 'refresh' them each time I deploy a new version of the code, as long as package.json did not change?
Note: this would be especially useful for 'native' modules, whose compilation takes a bit of time; for .js-only modules, I was successful removing them from package.json, and adding their node_modules/ folder in the git repo.
I'm the maintainer of the official Heroku Node.js Buildpack.
We have a new version of the buildpack in beta that features caching support, designed specifically for the use case you described above. You can read more about it at https://github.com/heroku/heroku-buildpack-nodejs/tree/diet#about-this-refactor
Eventually this will become the default Node.js buildpack on Heroku, but if you want to use it now you'll need to set the BUILPACK_URL config var explicitly:
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#diet -a my-node-app
git commit -am "fakeout" --allow-empty
git push heroku
Seems like there has recently been progress by David Dollar at the heroku-buildpack-nodejs.
In short:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-nodejs
See answer here: https://stackoverflow.com/a/18535675/1318839
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With