Skip to content

tslib is automatically added to dependencies #13886

@waterplea

Description

@waterplea

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

I don't think so

Description

I have a super small Angular library which I want to not have dependencies at all. It only has peer dependencies for @angular/core and @angular/forms. I've removed importHelpers flag from all tsconfig files as I've noticed that my generated js code does not have any tslib mentions. However when I do ng build in generated package.json I still get

  "dependencies": {
    "tslib": "^1.9.0"
  }

🔬 Minimal Reproduction

I've made a basic workspace with a library using Angular CLI:

ng new foo --create-application=false
cd foo
ng generate library foo-lib

Then I wrote my mini library, removed all tslib references from all package.json files and all importHelpers flags from all tsconfig.json files. Then I did npm i and ran:

ng build

🔥 Exception or Error

No error but tslib is added to dependencies.

🌍 Your Environment


Angular CLI: 7.3.5
Node: 10.15.1
OS: win32 x64
Angular: 7.2.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.5
@angular-devkit/build-angular      0.13.5
@angular-devkit/build-ng-packagr   0.13.5
@angular-devkit/build-optimizer    0.13.5
@angular-devkit/build-webpack      0.13.5
@angular-devkit/core               7.3.5
@angular-devkit/schematics         7.3.5
@angular/cli                       7.3.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.5
@schematics/angular                7.3.5
@schematics/update                 0.13.5
ng-packagr                         4.7.1
rxjs                               6.3.3
typescript                         3.2.4
webpack                            4.29.0

Anything else relevant?
If I understand correctly, tslib is a dependency of Angular and will be installed with it as it is in requires of @angular/core and many other Angular modules. Why would I need to add it manually to my library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions