Skip to content

Commit d2a277c

Browse files
authored
doc caveat with pnpm-workspace.yaml and auto import (#436)
* doc caveat with pnpm-workspace.yaml and auto import * Add a FAQ entry as well.
1 parent a26d925 commit d2a277c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

docs/faq.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ then you are hitting https://github.com/bazelbuild/bazel/issues/15605
4848
The workaround is to patch the package.json of any offending packages in npm_translate_lock, see https://github.com/aspect-build/rules_js/issues/148#issuecomment-1144378565.
4949
Or, if a newer version of the package has fixed the duplicate keys, you could upgrade.
5050

51+
If the error looks like this: `ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@my-workspace%2Ffoo: Not Found - 404`, where `foo` is a package living in a workspace in your local
52+
codebase and it's being declared [`pnpm-workspace.yaml`](https://pnpm.io/pnpm-workspace_yaml) and that you are relying on the `yarn_lock` attribute of `npm_translate_lock`, then
53+
you're hitting a caveat of the migration process.
54+
55+
The workaround is to generate the `pnpm-lock.yaml` on your own as mentioned in the migration guide and to use the `pnpm_lock` attribute of `npm_translate_lock` instead.
56+
5157
## In my monorepo, can Bazel output multiple packages under one dist/ folder?
5258

5359
Many projects have a structure like the following:

docs/migrate.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ rather than `npm` or `yarn` when changing dependency versions or adding new depe
6262
If needed, you might have both the pnpm lockfile and your legacy one checked into the repo during a migration window.
6363
You'll have to avoid version skew between the two files during that time.
6464

65+
Please note that using the `yarn_lock` attributes of `npm_translate_lock` has caveat of not supporting the [`pnpm-workspace.yaml`](https://pnpm.io/pnpm-workspace_yaml) which is needed by
66+
`pnpm` to declare workspaces. Therefore, if your project need this, the only option is to migrate to `pnpm` immediately and use solely the
67+
`pnpm_lock` attribute of `npm_translate_lock`.
68+
6569
## Test whether pnpm is working
6670

6771
A few packages have bugs which rely on "hoisting" behavior in yarn or npm, where undeclared dependencies can be loaded because they happen to be installed in an ancestor folder under `node_modules`.

0 commit comments

Comments
 (0)