Skip to content

Support pnpm 10 with onlyBuiltDependencies and ignoredBuiltDependencies #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AudunWA opened this issue Feb 17, 2025 · 3 comments
Open

Comments

@AudunWA
Copy link

AudunWA commented Feb 17, 2025

pnpm 10.0.0 Blocks Lifecycle Scripts by Default, and pnpm.onlyBuiltDependencies has to be set in package.json for them to be built. Isolate Package does not handle this.

Possible solutions (open to others as well):

  • Check onlyBuiltDependencies and ignoredBuiltDependencies from the monorepo root, and apply it to the isolated package.json
  • Preserve onlyBuiltDependencies and ignoredBuiltDependencies from the isolated module's package.json.
@0x80
Copy link
Owner

0x80 commented Feb 17, 2025

Thanks for brining it under my attention.

Since these are part of the pnpm property, I think we can just include that in its totality (if it exists).

@rangermeier
Copy link

For anyone having similar issues with this, I have worked around it by monkey-patching the isolated package.json.

In my cases I needed Puppeteer to install its Chrome binaries. I have added a script in my project's main package.json:

{
  ...
  "scripts": {
    "patchIsolatedPackageJson": "sed -i -e 's/\\\"pnpm\\\": {/\"pnpm\": {\"onlyBuiltDependencies\": [\"puppeteer\"],/' ./packages/<project>/isolate/package.json",
  }
}

And added this to the "predeploy" scripts of the affected function in firebase.json:

{
  "functions": [
    {
      "source": "./packages/<project>/isolate",
      "codebase": "<project>",
      "predeploy": [
        "pnpm run predeployFirebase"
        "pnpm run patchIsolatedPackageJson"
      ]
    },
  ]
}

@0x80
Copy link
Owner

0x80 commented Jun 3, 2025

I'll try to pick this up soon, because it should be an easy fix. Of course PRs are welcome too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants