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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes on IE11 and lower, Syntax error #5832

Open
Luke93dev opened this issue Nov 16, 2018 · 15 comments
Open

Application crashes on IE11 and lower, Syntax error #5832

Luke93dev opened this issue Nov 16, 2018 · 15 comments
Milestone

Comments

@Luke93dev
Copy link

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Environment

node version: 8.11.1,
npm version: 5.6.0

This problem is specific for IE11 running on Windows 10

Steps to Reproduce

  1. npx create-react-app my-app
  2. cd my-app
  3. npm start
  4. Open application in IE11 browser

Expected Behavior

I expected my app to load, like it does in Chrome, Firefox and Safari.

Actual Behavior

Got console error - "Syntax error" after running npm start command. Debugger points to ansi-regex dependecy in node-modules, the problem is ES6 arrow function syntax. Any ideas how can I fix this? I tried using react-app-polyfill package but with no results.

image

It seems related to this old topic: #2691

ansi-regex in version 3.00 or higher exports arrow functions instead of regular functions and it causes error in IE11. Previously package version was downgraded, but now it seems to be bumped to 3.00 again

@miraage
Copy link

miraage commented Nov 16, 2018

Do you have a required polyfill included as the very first line in your src/index.js?

@Luke93dev
Copy link
Author

Do you have required polyfill included as the very first line in your src/index.js?

Sure,
image

@Timer Timer added this to the 2.1.x milestone Nov 16, 2018
@Luke93dev
Copy link
Author

I ran - npm run build, and then served built aplication using Express locally - it works perfectly on IE11 :)

So the problem seems to happen only with npm start

@Linkontoask
Copy link

You need to configure the webpack. config. js file in vue. Maybe you need to use the npm run eject command to expose the configuration file. These are just some of my suggestions.

@dep-deprecated
Copy link

I'm having the same issue. Any updates are appreciated.

@dep-deprecated
Copy link

To those who end up here, I found success using babel-engine-plugin to transpile the necessary node_modules for ie11.

@akaguny
Copy link

akaguny commented Feb 15, 2019

To those who end up here, I found success using babel-engine-plugin to transpile the necessary node_modules for ie11.

you dont need transpile node_modules, if import 'react-app-polyfill/ie11'; don`t work on first line your app pls clear cache IE (Ctrl+Shift+Delele)

@gaearon
Copy link
Contributor

gaearon commented Feb 15, 2019

It is a known issue that the development version (npm start) is currently broken on IE11. But the production version (npm run build) should work.

@dep-deprecated
Copy link

you dont need transpile node_modules, if import 'react-app-polyfill/ie11'; don`t work on first line your app pls clear cache IE (Ctrl+Shift+Delele)

This is true unless you're using react-dev-utils/webpackHotDevClient which crashes unless you transpile node_modules manually for IE11 (in my experience at least)

@iansu iansu modified the milestones: 2.1.x, 3.x Mar 10, 2019
@jackblackCH
Copy link

jackblackCH commented May 7, 2019

Any updates on this? Is it planned to make the development version npm start to work in IE11?
It's not meant to develop ever in IE11, it's obvious that it would be super slow. It's more about being able to smoke test the "create-react-app" in IE11.

After copy/pasting the polyfill lines from the https://github.com/facebook/create-react-app/tree/master/packages/react-app-polyfill I believe many devs try to npm start the app again and expecting it to work, this is a bit confusing. So maybe an update of the docs that it works, but only via npm run build could be enough.

@StJohn3D
Copy link

StJohn3D commented Jul 2, 2019

One of my older apps was still working and it was on react-scripts @ v2.1.5 so I just downgraded my react-scripts to "react-scripts": "2.1.5" until this issue is resolved.
Be warned though, installing that version will get you this message: found 68 vulnerabilities (63 low, 5 high)

@newtonanbarasu
Copy link

@StJohn3D thanks it's working fine if I update version to "react-scripts": "2.1.5"

@StJohn3D
Copy link

@Luke93dev @jackblackCH @newtonanbarasu and anyone else arriving here, there is a better solution outlined here: #6924 (comment)

@alexfromapex
Copy link

If you're still stuck, hopefully this helps: https://medium.com/@matwankarmalay/create-react-app-ie11-script1002-syntax-error-how-to-get-rid-of-it-d70000c53ddf

@ffersants
Copy link

Using React scripts 5.0.0, what worked for me on IE 11 was:

  1. Including the following imports at first line of index.js
    import "react-app-polyfill/ie11";
    import "react-app-polyfill/stable";

  2. Including ie 11 in my browserlist on package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests