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.

[Feature] Support `yarnclean` functionality via resolutions or config

See original GitHub issue
  • I’d be willing to implement this feature (with some guidance perhaps, I’m not familiar with the berry codebase)
  • This feature can already be implemented through a plugin

Describe the user story

Some important dependencies have malformed dependency lists and bring in transitive packages that can break builds. The example I have in mind is @types/styled-components, which brings in @types/react-native, which clashes with DOM typings built into TypeScript.

In Yarn v1, I could add @types/react-native to .yarnclean, and that dependency would not be be installed. This only makes a single repository work though.

Describe the solution you’d like

Perhaps there’s a way to block dependencies from being included in the current package and downstream dependencies

e.g.

"dependencies": {
   "@types/styled-components": "^5.3.1",
},
"resolutions": {
   "@types/react-native": null
}

or

"dependencies": {
   "@types/styled-components": "^5.3.1",
},
"excludeDependencies": ["@types/react-native"]

Describe the drawbacks of your solution

An extension like this would be yarn-specific, and npm clients would still have that extension drawn into their workspace.

Additional context

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33015

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
merceyzcommented, Jul 24, 2020

I guess you could try with aliasing it to the normal react types.

"resolutions": {
  "@types/react-native": "npm:@types/react@*"
},

Is this a problem in both PnP and node_modules or?

0reactions
darthtrevinocommented, Jul 25, 2020

The workaround did work in my projects - it’s not the most straightforward of configs, but it lets me use the types I want to use. I’ll leave this issue open as a suggestion for more direct approaches to problems like that

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selective dependency resolutions - Yarn
Yarn supports selective version resolutions, which lets you define custom package versions or ranges inside your dependencies through the resolutions field ...
Read more >
Aafter Upgrade to Webpack 5 yarn start failing - Stack Overflow
uninstall webpack and install it with latest version again.Then followed webpack.js.org/migrate/5 .Updated all loader withhh configration ...
Read more >
scandit-sdk - npm
Start using scandit-sdk in your project by running `npm i ... The configuration function returns a promise and looks as follows:.
Read more >
Yarn audit and autoclean commands - w3resource
In this tutorial we will introduce you to yarn audit and autoclean commands. Yarn audit. The yarn audit command checks for vulnerabilities ...
Read more >
Scandit Barcode Scanner SDK for the Web
Enterprise barcode scanning performance in your browser via JavaScript and WebAssembly. Made by Scandit ... The configuration function looks as follows:
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