Skip to content

Patches not applied when using Heroku's Node buildpack #130

Closed
@OliverJAsh

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:

  1. install all dependencies (including devDependencies) with yarn --production="false"
  2. run build step
  3. prune dev dependencies with yarn --production="true"
  4. 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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions