Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

string.split ie unexpected result #16955

Closed
1 of 15 tasks
TurnsOut opened this issue Feb 12, 2020 · 11 comments
Closed
1 of 15 tasks

string.split ie unexpected result #16955

TurnsOut opened this issue Feb 12, 2020 · 11 comments

Comments

@TurnsOut
Copy link

TurnsOut commented Feb 12, 2020

馃悶 Bug report

  • 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

@alan-agius4
Copy link
Collaborator

This seems to be a regression from core-js. Here鈥檚 an open issue zloirock/core-js#751

@PetarMetodiev
Copy link

The issue seems to have been fixed - zloirock/core-js#741 (comment)

@TurnsOut
Copy link
Author

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
Copy link

@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
Copy link

I can verify this on angular.io btw:

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

@TurnsOut
Copy link
Author

@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
Copy link
Collaborator

alan-agius4 commented Feb 24, 2020

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 alan-agius4 self-assigned this Feb 24, 2020
@jpzwarte
Copy link

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

@alan-agius4
Copy link
Collaborator

@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

@alan-agius4
Copy link
Collaborator

Closed via #17059

@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 Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants