angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.97k forks source link

string.split ie unexpected result #16955

Closed TurnsOut closed 4 years ago

TurnsOut commented 4 years ago

🐞 Bug report

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

πŸ”₯ 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

alan-agius4 commented 4 years ago

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

PetarMetodiev commented 4 years ago

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

TurnsOut commented 4 years ago

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 core-js@3.6.4 and including in polyfill does not change behaviour.

jpzwarte commented 4 years ago

@TurnsOut afaics @angular-devkit/build-angular uses core-js@3.6.0 (see node_modules/@angular-devkit/build-angular/node_modules/core-js/package.json) even though i have core-js@3.6.4 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?

jpzwarte commented 4 years ago

I can verify this on angular.io btw:

TurnsOut commented 4 years ago

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

alan-agius4 commented 4 years ago

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"
  },
jpzwarte commented 4 years ago

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

alan-agius4 commented 4 years ago

@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

alan-agius4 commented 4 years ago

Closed via https://github.com/angular/angular-cli/pull/17059

angular-automatic-lock-bot[bot] commented 4 years ago

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.