Patches not applied when using Heroku's Node buildpack #130
Description
This isn't an issue with patch-package
specifically, but I wanted to share it here nonetheless to help anyone else who might run into this.
When using Heroku's Node buildpack, by default the following will happen during the build and startup process:
- install all dependencies (including
devDependencies
) withyarn --production="false"
- run build step
- prune dev dependencies with
yarn --production="true"
- run the app
However, at step 3 when the dev dependencies are pruned, the buildpack also specifies the --ignore-scripts
flag when calling yarn
(since v119). This means patch-package
will not run, because the postinstall
/prepare
scripts will not be ran. In turn, this means when the app runs, Node modules will not be patched (!).
The only workaround I'm aware of at the moment is to disable pruning of dev dependencies with YARN_PRODUCTION=false
.
I can semi-understand why the buildpack would want to avoid invoking scripts, since the scripts were already run after step 1. In any case I've raised an issue with the buildpack to investigate what changes we can make there: heroku/heroku-buildpack-nodejs#634