Code Monkey home page Code Monkey logo

Comments (3)

KSXGitHub avatar KSXGitHub commented on August 18, 2024 1

CraigMacomber/FluidFramework#4

from pnpm.

CraigMacomber avatar CraigMacomber commented on August 18, 2024 1

CraigMacomber/FluidFramework#4

I can confirm that (setting link-workspace-packages=true) fixed our issue. Thank you for the fix or maybe its a workaround? Either way, I'm happy to have it!

Given all references to the requested version explicitly use "workspace:~", and it worked fine in pnpm 7 and 8, I think this might still be a regression, so maybe this bug should stay open.

Reading https://pnpm.io/workspaces#workspace-protocol-workspace : (Emphasis added)

By default, pnpm will link packages from the workspace if the available packages match the declared ranges. For instance, [email protected] is linked into bar if bar has "foo": "^1.0.0" in its dependencies and [email protected] is in the workspace. However, if bar has "foo": "2.0.0" in dependencies and [email protected] is not in the workspace, [email protected] will be installed from the registry. This behavior introduces some uncertainty.

Luckily, pnpm supports the workspace: protocol. When this protocol is used, pnpm will refuse to resolve to anything other than a local workspace package. So, if you set "foo": "workspace:2.0.0", this time installation will fail because "[email protected]" isn't present in the workspace.

This protocol is especially useful when the link-workspace-packages option is set to false. In that case, pnpm will only link packages from the workspace if the workspace: protocol is used.

Based on my interpretation of that:

  1. link-workspace-packages=true should only be needed if we don't use "workspace" versions, and we do use them.
  2. Even if we didn't use "workspace" versions, since the requested version is in the workspace, it should resolve to the version in the workspace, not search npm, even without link-workspace-packages=true.

The observed behavior is its searching npm, and failing to find the package despite it being in the workspace, and using a workspace version, both of which should have prevented it from searching npm. link-workspace-packages=true changes this, causing it to search the workspace for the workspace version, which it finds.

If this is intended behavior, I think those docs need updating for pnpm 9.

from pnpm.

KSXGitHub avatar KSXGitHub commented on August 18, 2024 1

@CraigMacomber I was able to find this fix quickly because I've read pnpm 9 breaking changes and knew that link-workspace-packages had been changed to false by default (it was true by default in pnpm 8).

Anyway, thanks for pointing out outdated documentation. I will correct it.

from pnpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.