Skip to content

Commit

Permalink
fix(angular): libraries should not contain tslib by default #21023 (#…
Browse files Browse the repository at this point in the history
…23423)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
When generating buildable and publishable angular libraries, we always
add `tslib` to the `package.json#dependencies`.
These libaries may not actually use this dependency and therefore it is
redundant.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Do not add `tslib` by default.
If users need it, they can add it when they do.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21023
  • Loading branch information
Coly010 authored May 16, 2024
1 parent d581cef commit 34547b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
"@angular/common": "<%= angularPeerDepVersion %>",
"@angular/core": "<%= angularPeerDepVersion %>"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
}
3 changes: 3 additions & 0 deletions packages/angular/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ describe('lib', () => {
expect(packageJson.devDependencies['postcss']).toBeDefined();
expect(packageJson.devDependencies['autoprefixer']).toBeDefined();
expect(packageJson.devDependencies['postcss-url']).toBeDefined();

const libPackageJson = readJson(tree, 'my-lib/package.json');
expect(libPackageJson.dependencies?.['tslib']).toBeFalsy();
});

it('should create project configuration', async () => {
Expand Down

0 comments on commit 34547b3

Please sign in to comment.