Skip to content

String.split misbehaves in chrome 51 with canary build #2199

@bdwain

Description

@bdwain

Can you reproduce the problem with latest npm?

yes

Description

The native string split method seems to no longer work correctly in the console (or my app) when i load my app in production mode (it's fine if i don't minify it). I've tracked this issue down to a specific change in how webpack uses uglify. i filed an uglify issue with a little more detail, but it's still relevant here because it's using those tools.

Expected behavior

In the console:

let str = 'fooBar'
str.split(/(?=[A-Z])/)

> ["foo", "Bar"]

Actual behavior

let str = 'fooBar'
str.split(/(?=[A-Z])/)

> ["fooBar"]

Environment

react-scripts@1.0.0-alpha.e280254d
node: v7.9.0
npm: 4.2.0
yarn (which i'm actually using, not npm): 0.23.3

os: os x sierra
browser: chrome 51 (other versions (back to chrome 30) seem fine)

Reproducible Demo

https://github.com/bdwain/uglify-bug

all you need to do to reproduce is run create-react-app with the canary build of react-scripts, and then npm install (or yarn add) babel polyfill and include it in your entry point. The result of yarn build will then cause the issue. Open a production build of the app (dev mode is fine), then open a console and try to run string split.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions