"@angular-devkit/architect": ">=0.1100.0 < 0.1200.0",
"@angular-devkit/build-angular": ">=0.1100.0 < 0.1200.0",
"@angular-devkit/core": "^11.0.0"
in "@angular-builders/custom-webpack" in some scenario with yarn causes that we have two different versions of these packages, one in node_modules root and another in node_modules/@angular-builders/custom-webpack/node_modules.
Moving these dependencies to peer dependencies in the published package.json can solve this problem.
Hey @abadakhshan , thanks for your suggestion. It has already been discussed, you can find my response here. You're also welcome to read the whole discussion in #873.
Thank you @just-jeb.
Please use Yarn to install dependencies with thispackage.json
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@angular-devkit/build-angular": "~0.1101.0",
"@angular-builders/custom-webpack": "~11.0.0"
}
}
After installing we have @angular-devkit\[email protected] in node_modules and @angular-devkit/[email protected] in node_modules\@angular-builders\custom-webpack\node_modules and this can cause many issues.
Am I doing something wrong?
Interesting... Seems like Yarn installs the latest version of Devkit for Angular Builders, although it is compatible with previous versions as well. I suppose this is how it works, not much that I can do.
Why are you restricting the Devkit version to 0.1101.*?
It was just an example.
This issue also happens when you have a yarn.lock with devkit 0.1101., then upgrade it to 0.1102..
Whenever I want to upgrade Angular libraries, I have to delete yarn.lock and node_modules@angular-builderscustom-webpacknode_modules.
I guess it's a problem with yarn, not with the builders. Am I missing something?
I guess it's a problem with
yarn, not with the builders. Am I missing something?
I created an issue for Yarn
https://github.com/yarnpkg/berry/issues/2482
@abadakhshan @just-jeb You might be interested to declare these dependencies as both peerDependencies and regular dependencies. In this case npm and yarn 1 will treat them as regular dependencies. Yarn 2+ will treat them as peerDependencies if they are provided by the parent package and regular dependencies if they were not provided by a parent package.
Most helpful comment
@abadakhshan @just-jeb You might be interested to declare these dependencies as both peerDependencies and regular dependencies. In this case
npmandyarn 1will treat them as regular dependencies. Yarn 2+ will treat them as peerDependencies if they are provided by the parent package and regular dependencies if they were not provided by a parent package.