question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yarn PnP is not compatible with optional peer dependencies

See original GitHub issue

This 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
arcaniscommented, Oct 10, 2018

@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, not node-sass itself (otherwise it would have to declare it as an optional peer dependency as well - once available).

0reactions
iansucommented, Jun 30, 2021

Can you try the latest release and see if this has improved? If not please open a new issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found