Skip to content

Commit

Permalink
Attempt to add rollup arm64 as dependency to rollup
Browse files Browse the repository at this point in the history
Results in same error. Rollup declares an optional dependency on the arm64 variant.

```
pnpm install && bazelisk run //:vite -- --help

private/var/tmp/_bazel_joe/1713d43747a35eb7e2009bc8fd9406b7/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup/dist/native.js:63
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (npm/cli#4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (/private/var/tmp/_bazel_joe/1713d43747a35eb7e2009bc8fd9406b7/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup/dist/native.js:63:9)
```

It looks like rules_js doesn't link optional dependencies and also doesn't use the
package.json `pnpm.packageExtensions` override.

```
ls -lh $BAZEL_OUT/darwin_arm64-fastbuild/bin/vite_/vite.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules

drwxr-xr-x@ 3 joe  wheel    96B Nov  7 13:35 @types
lrwxr-xr-x@ 1 joe  wheel   176B Nov  7 13:35 rollup -> $BAZEL_OUT/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/rollup
```

https://bazelbuild.slack.com/archives/CEZUUKQ6P/p1731014606302199?thread_ts=1730916056.708769&cid=CEZUUKQ6P
  • Loading branch information
jschaf committed Nov 7, 2024
1 parent 824447e commit 8e3ed3c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 86 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"pnpm": {
"onlyBuiltDependencies": [],
"packageExtensions": {
"vite": {
"optionalDependencies": {
"@rollup/rollup-darwin-arm64": "4.24.4"
"rollup": {
"dependencies": {
"@rollup/rollup-darwin-arm64": "*"
}
}
}
Expand All @@ -22,6 +22,7 @@
"devDependencies": {
"typescript": "~5.6.2",
"vite": "^5.4.9",
"rollup": "4.24.4",
"@rollup/rollup-darwin-arm64": "4.24.4"
}
}
160 changes: 77 additions & 83 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e3ed3c

Please sign in to comment.