feat: enable tslib helpers
See original GitHub issueType of Issue
[ ] Bug Report
[x] Feature Request
Description
Not sure if you already have considered this, however, doesn’t make sense to enable tslib helpers by default? if not some kind of config override might be needed in order to allow this.
all it needs
"compilerOptions": {
"importHelpers": true
}
- add
tslib
as dependency
https://github.com/Microsoft/tslib
Expected Behaviour
tslib helpers not emitted in the output, as this will make the build smaller.
Version Information
ng-packagr: v2.0.0-rc.4
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (7 by maintainers)
Top Results From Across the Web
importHelpers - TypeScript: TSConfig Option
importHelpers. For certain downleveling operations, TypeScript uses some helper code for operations like extending class, spreading arrays or objects, and async ...
Read more >External Helpers Library in TypeScript - Marius Schulz
TypeScript 2.1 adds a compiler option for importing helper functions from an external library. The helpers aren't injected into every file, ...
Read more >How to use the tslib.__decorate function in tslib - Snyk
To help you get started, we've selected a few tslib.__decorate examples, based on popular ways it is used in public projects.
Read more >Webpack and Typescript `__extends` - Stack Overflow
aliases: { 'tslib$': 'tslib/tslib.es6.js', }. And configure your tsc / tsconfig.json not to emit the helper functions for every module:
Read more >Using tslib for TypeScript 2.1 with Aurelia to save bandwidth
Support for external helpers library (tslib) TypeScript injects a handful of helper functions ... in the tsconfig.json file to enable this feature to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure I will check it out 👍
Not sure if it make sense to add
tslib
as adependency
in the generatedpackage.json
, or you recommend simply have to it to add it to your mainpackage.json
manually?Hi @stephenlautier,
considered, yes. Aren’t the
__ decorate
,__extends
, and so on helpers not required to be included at least once in the esm5 bundle?You made me check Angular’s GitHub builds repos and
@angular/common
is:FESM’5 Bundle:
https://github.com/angular/common-builds/blob/master/esm5/common.js
UMD Bundle:
https://github.com/angular/common-builds/blob/master/bundles/common.umd.js#L32-L44
TL;DR: you’re right … the quickest way to get there is to set
"importHelpers": true
and then let rollup inline the tslib helpers to the top of the bundles.