Make downleveling of code from ES2015 to ES5 optional when generating UMD bundles
See original GitHub issueType of Issue
[ ] Bug Report
[X] Feature Request
Description
I want to use ES2015 UMD bundles along with the ES2015 version of Angular. These libraries are loaded at runtime using SystemJS in the browser.
Currently, the generated UMD bundles are automatically transpiled to ES5. This results in errors in libraries which have classes that are extending ES2015 classes coming from other libraries that are loaded at runtime.
Feature request: Add a configuration parameter to make it optional to transpile from ES2015 to ES5.
Some details regarding my specific usecase: I am using single-spa with multiple Angular applications and am trying to share the same angular libraries between all of the applications.
Am using Angular 11 with Ivy, and wanted to use the ES2015 version of the library. Currently, when using the UMD version of the single-spa-angular
library (generated with ng-packagr) with this, it throws an error, since an ES5 class in that library is trying to extend an ES2015 class from Angular.
The exact details of the error have been captured here: https://github.com/single-spa/single-spa-angular/issues/370
Additional investigation here: https://github.com/single-spa/single-spa-angular/issues/370#issuecomment-859545789
Expected Behaviour
The source code in ng-packagr relevant to this is:
This seems to be explicitly transpiling the ES2015 UMD bundle to ES5. This could be made optional.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 11.2.4
@angular/compiler: 11.2.3
typescript: 4.0.5
rollup: 2.40.0
node: v12.22.1
npm: 7.16.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
Drive by comment, my-packagr follows the APF specs which implies that UMDs should be in ES5 format.
Including an option that allows UMDs to contain ES2015, is not on the table for 2 main reasons. Firstly because this goes against the spec and secondary because UMD format will likely be dropped in the near future.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.