Angular-cli: The Array.includes polyfill is not added to the polyfills-es5.ts file

Created on 18 Jun 2019  路  3Comments  路  Source: angular/angular-cli

馃悶 Bug report

I try to run my app in IE11. In the browser console I get this error
TypeError: Object doesn't support property or method 'includes', but with Differential Loading concept Angular should automatically add the polyfills with the used setup. My browserslist looks like

> 0.5%
last 2 versions
Firefox ESR
IE 11

A temporary workaround is to add import 'core-js/features/array/includes' in the polyfills.ts file.

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?


The previous versions don't have the Differential Loading concept

Description

See above

馃敩 Minimal Reproduction

  1. See the repo https://github.com/destus90/cli-array-includes-issue
  2. Clone it, install modules and run ng build command.
  3. Run some static server (for example node-static), go to IE11 and check out the browser's console.

馃敟 Exception or Error




TypeError: Object doesn't support property or method 'includes'

馃實 Your Environment




Angular CLI: 8.0.3
Node: 12.3.1
OS: win32 x64
Angular: 8.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.3
@angular-devkit/build-angular     0.800.3
@angular-devkit/build-optimizer   0.800.3
@angular-devkit/build-webpack     0.800.3
@angular-devkit/core              8.0.3
@angular-devkit/schematics        8.0.3
@angular/cli                      8.0.3
@ngtools/webpack                  8.0.3
@schematics/angular               8.0.3
@schematics/update                0.800.3
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

Most helpful comment

For future Google search visitors:

import 'core-js/modules/es.array.includes';

All 3 comments

Hi, thanks for opening the issue. However we only include polyfills which are directly required by the Angular framework.

If you include code that requires additional polyfills to work on older browsers, you need to include these yourself in the polyfills.ts file.

For future Google search visitors:

import 'core-js/modules/es.array.includes';

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateenKadwaikar picture MateenKadwaikar  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

hartjo picture hartjo  路  3Comments

rwillmer picture rwillmer  路  3Comments

delasteve picture delasteve  路  3Comments