Skip to content

Angular 13: Add ability to generate esm5 bundle #22434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 15 tasks
danilmoro3 opened this issue Dec 30, 2021 · 2 comments
Closed
1 of 15 tasks

Angular 13: Add ability to generate esm5 bundle #22434

danilmoro3 opened this issue Dec 30, 2021 · 2 comments

Comments

@danilmoro3
Copy link

danilmoro3 commented Dec 30, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

As IE11 is no longer supported by Angular 13, there is no way to generate esm5 bundle.
Therefore, generated esm2020 bundles is not compatible in the projects with an old version of angular.

🔬 Minimal Reproduction

Run the following command in any project:

nx build some-lib

🔥 Exception or Error

See generated bundle, there are no esm5 and lib bundles with .js files inside (not .mjs):


- esm2020
- fesm2015
- fesm2020
- lib
...

🌍 Your Environment

nx report:


  Node : 14.15.0
  OS   : darwin x64
  npm  : 6.14.8
  
  nx : 13.3.6
  @nrwl/angular : 13.3.6
  @nrwl/cli : 13.3.6
  @nrwl/cypress : 13.3.6
  @nrwl/devkit : 13.1.3
  @nrwl/eslint-plugin-nx : 13.3.6
  @nrwl/express : undefined
  @nrwl/jest : 13.3.6
  @nrwl/linter : 13.3.6
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : 13.0.0
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.3.6
  @nrwl/web : undefined
  @nrwl/workspace : 13.3.6
  @nrwl/storybook : 13.3.6
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 7.4.0
  ---------------------------------------
  Community plugins:
         @angular/animations: 13.1.1
         @angular/cdk: 13.1.0
         @angular/common: 13.1.1
         @angular/compiler: 13.1.1
         @angular/core: 13.1.1
         @angular/elements: 13.1.1
         @angular/forms: 13.1.1
         @angular/platform-browser: 13.1.1
         @angular/platform-browser-dynamic: 13.1.1
         @angular/router: 13.1.1
         ng-zorro-antd: 12.1.0
         @angular-devkit/build-angular: 13.0.0
         @angular-eslint/builder: 13.0.1
         @angular-eslint/schematics: 13.0.1
         @angular/cli: 13.1.2
         @angular/compiler-cli: 13.1.1
         @angular/language-service: 13.1.1
         @storybook/angular: 6.4.9

tsconfig.base.json


...
"target": "es2015",
"module": "esnext",
"typeRoots": ["node_modules/@types"],
"lib": ["es2015", "es2019", "dom"],
...
@danilmoro3 danilmoro3 changed the title Angular 13: Add ability to generate esm2015 bundle Angular 13: Add ability to generate esm5 bundle Dec 30, 2021
@JoostK
Copy link
Member

JoostK commented Dec 30, 2021

Angular Package Format has not included ES5 sources for quite some time (Angular 10) and this is unrelated to IE11 support.
The CLI will automatically downlevel ES2020/ES2015 library code to ES5 when bundling an application that requests an ES5 output format.

Therefore, generated esm2020 bundles is not compatible in the projects with an old version of angular.

A library should never be used in older versions of Angular than they were build in.

@JoostK JoostK closed this as completed Dec 30, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants