-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
What package manager are you using?
yarn 3.1
What operating system are you using?
Mac
Describe the Bug
I've been experimenting with Astro and Yarn 3 in PnP mode.
PnP mode is strict about packages requiring dependencies, and it does not allow them to be hijacked from other packages.
Astro is doing some things wrong in this regard, for example it uses fast-glob but it's nowhere in package.json. I suspect the pnpm package manager will also have problems with this.
Steps to Reproduce
yarn create astro --template framework-react
yarn set version berry
yarn
yarn dev
➜ yarn dev
(node:91510) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: astro tried to access fast-glob, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: fast-glob (via "fast-glob/package.json")
Required by: astro@npm:0.20.12 (via /.../.yarn/cache/astro-npm-0.20.12-5a08c46146-1be4d53e64.zip/node_modules/astro/dist/check.js)
fast-glob is indeed imported here:
https://github.com/snowpackjs/astro/blob/b1b564d03d09cee63e072397dfb2ab1a1f59b346/packages/astro/src/check.ts#L5
But it's not defined in any package.json.
This is a correctness issue. See: https://yarnpkg.com/advanced/rulebook/#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies
Link to Minimal Reproducible Example (Optional)
No response
Metadata
Metadata
Assignees
Labels
No labels