Angular-cli: string.split ie unexpected result

Created on 12 Feb 2020  路  11Comments  路  Source: angular/angular-cli

馃悶 Bug report

  • [x] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

This used to work in angular8.

Description


"tick".split(/^|\s+/) 

yields different results in chrome and ie.

I would expect results to be the same in chrome and ie.

馃敩 Minimal Reproduction

  • ng new angular9stringSplit (routing yes, stylesheet scss)
  • change "target" from "es2015" to "es5" in tsconfig.json
  • add constructor to app.component.ts with "console.log('tick'.split(/^|\s+/));"
  • serve
  • compare output in ie (["t","i","c","k"]) with chrome (["tick"])

馃敟 Exception or Error

馃實 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.1
Node: 12.3.1
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.1
@angular-devkit/core         9.0.1
@angular-devkit/schematics   9.0.1
@schematics/angular          9.0.1
@schematics/update           0.900.1
rxjs                         6.5.3

edit 24/02/2020:
updated to



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.3
Node: 12.3.1
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.3
@angular-devkit/core         9.0.3
@angular-devkit/schematics   9.0.3
@schematics/angular          9.0.3
@schematics/update           0.900.3
rxjs                         6.5.3

Anything else relevant?

When debugging i see that polyfill https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js is already in use. Adding it again in polyfills.ts doesn't make a difference.

Unrelated: I'm migrating an angular8 app with d3 to angular9, d3 depends on this for registering callbacks. https://github.com/d3/d3-selection/blob/master/src/selection/on.js#L35

devkibuild-angular medium regression bufix

All 11 comments

This seems to be a regression from core-js. Here鈥檚 an open issue https://github.com/zloirock/core-js/issues/751

The issue seems to have been fixed - https://github.com/zloirock/core-js/issues/741#event-2921184049

Cannot confirm that this is fixed.

Updated angular-cli to 9.0.3

Repro mentioned above still creates a project with the issue. Specifically installing [email protected] and including in polyfill does not change behaviour.

@TurnsOut afaics @angular-devkit/build-angular uses [email protected] (see node_modules/@angular-devkit/build-angular/node_modules/core-js/package.json) even though i have [email protected] in my app's package.json.

@alan-agius4 any chance we can try a new version of the cli with core-js > 3.6.0 to see if that fixes this problem?

I can verify this on angular.io btw:

  • Go to angular.io in IE11
  • Open devtools console
  • Run "tick".split(/^|\s+/)

@jpzwarte yes, i can see from 'npm list | grep core-js' that there is core-js 3.6.0, core-js-compat 3.6.4, as well as core-js 3.6.4.

I don't know that construct. Should i be doing something different?

Tried this locally and it seems that indeed updating to 3.6.4 solved the issue.

If you are using yarn you can add the below in your package.json as test/temp workaround

  "resolutions": {
    "core-js": "3.6.4"
  },

@alan-agius4 i'm confused: https://github.com/angular/angular-cli/pull/16655/files
CLI already uses 3.6.4???

@jpzwarte, that PR was only merged to master. Version 9.0.x is on a different branch which still uses core-js 3.6.0

https://github.com/angular/angular-cli/blob/45d8811c6a312d15b5e24cdfca90084641a3fe36/packages/angular_devkit/build_angular/package.json#L28

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