angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open giri3sg opened this issue 6 years ago β€’ 3 comments

This is duplicate of https://github.com/angular/angular-cli/issues/14815

The fix isn't provided by cli yet.

🐞 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?

The previous versions don't have the Differential Loading concept

Description

When updating from 7 to 8: The angular schematic that does the migration drops all polyfills of array functions

https://github.com/angular/angular-cli/blob/9c4da54b63ed2fe526355c937952aaba3b888497/packages/schematics/angular/migrations/update-8/drop-es6-polyfills.ts#L33

but the angular 8 cli polyfills doesn't include the polyfill import 'core-js/modules/es.array.includes';

https://github.com/angular/angular-cli/blob/9c4da54b63ed2fe526355c937952aaba3b888497/packages/angular_devkit/build_angular/src/angular-cli-files/models/es5-polyfills.js#L37

the workaround is manually adding the missing polyfill to polyfills.ts.

looking for a fix from angular team.

giri3sg avatar Mar 13 '20 11:03 giri3sg

array.includes is not part of ES6 (ES2015) and was not previously nor currently polyfilled by the CLI. It is rather part of ES2016 as defined here. For core-js 2.x, it was located at core-js/es7/array which is not in the list to drop and should have been retained when migrating if it was manually added.

clydin avatar Mar 13 '20 17:03 clydin

@clydin thanks for the explanation. :)

giri3sg avatar Mar 17 '20 08:03 giri3sg

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.