Yarn PnP is not compatible with optional peer dependencies
See original GitHub issueThis makes PnP incompatible with how we’re shipping Sass and planning to ship future enhancements (e.g. TypeScript).
Optional peer dependencies are vital to keeping initial install sizes low (less of a problem with PnP, but imagine a cache miss).
See broken test:
./src/AppSass.scss
- To import Sass files, you first need to install node-sass.
- Run `npm install node-sass` or `yarn add node-sass` inside your workspace.
+ Error: Package "sass-loader@7.1.0" (via "/Users/joe/Library/Caches/Yarn/v3/npm-sass-loader-7.1.0-16fd5138cb8b424bf8a759528a1972d72aad069d/node_modules/sass-loader/lib/loader.js") is trying to require the package "node-sass" (via "node-sass") without it being listed in its dependencies (webpack, clone-deep, loader-utils, lodash.tail, neo-async, pify, semver, sass-loader)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Plug'n'Play | Yarn - Package Manager
This means that the common pattern of trying to require an optional peer dependency inside a try/catch block will print a warning at...
Read more >@yarnpkg/doctor - npm
Peer dependencies are useful for allowing package authors to delegate control of a dependency's version to the package user. When used ...
Read more >What could cause an error related to npm not being able to ...
Delete node_modules folder manually. · Open command prompt , go to path angular folder and run Yarn. · Run angular\nswag\refresh.bat. · Run npm ......
Read more >Manage build dependencies | Netlify Docs
YARN_FLAGS : used to indicate the flags to pass to the yarn command. Includes --ignore-optional by default. You can override this by adding...
Read more >.npmrc | pnpm
Same as the node_modules created by npm or Yarn Classic. ... When true , any missing non-optional peer dependencies are automatically ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@timer 😢 Not an option because of the warning, right? Is there something else, or would fixing this in Yarn be good enough for you?
@bugzpodder It also depends on how you’ll want the cra users to specify that they want to use dart-sass, but overall it shouldn’t be an issue with PnP, since it’s the configuration file that will make the
require
call, notnode-sass
itself (otherwise it would have to declare it as an optional peer dependency as well - once available).Can you try the latest release and see if this has improved? If not please open a new issue.