Pnpm: feature request: workspace dependencies alias

Created on 10 May 2020  Â·  4Comments  Â·  Source: pnpm/pnpm

pnpm version: 4.14.2

Code to reproduce the issue:

Hi, within one of my workspaces I am trying to create an alias for a workspace dependency:

"dependencies": {
    "foo": "workspace:@bar/baz"
}

Expected behavior:

The @bar/baz workspace would be added as a dependency, but inside the node_modules the symlink would be named foo.

Actual behavior:

However it seems that aliases for workspace dependencies aren't supported, resulting in the following error:

Scope: all 2 workspace projects
ERROR  Invalid workspace: spec (workspace:@bar/baz)
at Error: Invalid workspace…

Additional information:

  • node -v prints: v12.16.0
  • Windows, OS X, or Linux?: windows 10
monorepo

Most helpful comment

That syntax will work. It will search for @bar/baz in the repository before searching in the registry

All 4 comments

if you just write "foo": "npm:@bar/baz", it should work. Of course, supporting something similar through the workspace protocol would be nice as well.

Yes that's my problem, I need to create an alias for a workspace, not a package on the npm registry.

That syntax will work. It will search for @bar/baz in the repository before searching in the registry

That's great thanks! It works perfectly :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreineculau picture andreineculau  Â·  3Comments

andreineculau picture andreineculau  Â·  5Comments

zkochan picture zkochan  Â·  3Comments

zkochan picture zkochan  Â·  3Comments

vjpr picture vjpr  Â·  5Comments