question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SCRIPT1002: Syntax error - IE11 - Polyfill - Development Mode

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes. I am using docker and have re-built my container multiple times.

I have also tried using a previous version of react-scripts / create-react-app

npm --version output: 6.9.0

Which terms did you search for in User Guide?

Searched For: IE11, Syntax Error, Script1002, Polyfill.

I followed the guide for adding polyfills using react-app-polyfill. The first two lines in my index.js file are import ‘react-app-polyfill/ie11’; import ‘react-app-polyfill/stable’;

I have tried with & without stable. I have tried with ie11 & ie9 polyfills.

Environment

System: OS: Linux 3.10 Debian GNU/Linux 9 (stretch) 9 (stretch) CPU: (4) x64 Intel® Xeon® CPU E5-2650 v3 @ 2.30GHz Binaries: Node: 12.0.0 - /usr/local/bin/node Yarn: 1.15.2 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Browsers: Chrome: Not Found Firefox: Not Found npmPackages: react: ^16.8.6 => 16.8.6 react-dom: ^16.8.6 => 16.8.6 react-scripts: 3.0.0 => 3.0.0 npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

  1. Create a new create-react-app project following the steps provided by the user guides
  2. browse to website on chrome and see it working perfectly.
  3. browse to website on Internet explorer 11 and it just displays a white screen and an error in the console.

Expected Behavior

My app should work on internet explorer 11 in the same manner it works in chrome

Actual Behavior

I’ll put the specific details here.

The app i’ve been working on for a year or so with create-react-app stopped working in IE11 when I updated it yesterday.

To ensure that it was not my own code that broke IE11 support, I spun up a brand-new copy of create-react-app to test and it still did not work on IE11.

I followed the steps for react-app-polyfill and that still did not work on IE11.

I have tried to force NPM to install a previous version of react-scripts/create-react app using npm i react-scripts@2.0.5 but that doesn’t work. (Note: 2.0.5 is the last version i was on when I had a container working perfectly on IE11 5 months ago.) {Edit} when i try installing this past version, I check the package.json and it says react-scripts is at version 3.0.0 despite specifying 2.0.5

Index.js image

Website On Chrome: image

Website on IE11: image image image

Reproducible Demo

Here is the dockerfile I use to boot up this container:

FROM node:12.0

RUN apt-get update -y && \
apt-get install -y vim

WORKDIR /var/www/html
RUN npm i create-react-app@3.0.0
RUN npx create-react-app welcome
RUN npm i react-app-polyfill
WORKDIR /var/www/html/welcome

CMD ["npm","start"]

Here is the docker-compose file I’m using:

version: '3'
services:
  react-testing:
    container_name: practice
    image: practice-react
    build:
      context: ./
      dockerfile: dockerfile
    ports:
      - "5900:3000"

networks:
  default:
    external:
      name: practice.react

To build your own demo environment to test this for yourself, the steps are as follows: (this is going to assume you know some docker basics. Otherwise you can install create-react-app normally and test it that way)

  1. docker-compose build
  2. docker-compose up -d
  3. docker exec -it practice bash
  4. cd src
  5. vi index.js
  6. add the two polyfill lines to the top of index.js
  7. save and quit vi
  8. go to the webpage on IE11.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ianschmitzcommented, Apr 27, 2019

"ie 11" should be enough. You can try using the default values from production as well as they will include ie 11 support.

Try deleting your node_modules folder after making the change as I believe I’ve experienced Babel caching not detecting the new values

0reactions
ianschmitzcommented, Apr 28, 2019

Glad to hear it worked. The default prouduction list is quite generous and does include ie 11 already via the >0.2% item, so it’s not expliclty needed (until the time when the usage is below 0.2% of course).

Here is a handy tool to see the result: https://browserl.ist/?q=>0.2%25%2C+not+dead%2C+not+op_mini+all.

The react-app-polyfill/stable polyfill isn’t required to get things working, as it will polyfill ALL stable language features, while the react-app-polyfill/ie11 module will only polyfill the bare minimum needed by React/CRA.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create React App IE11 : SCRIPT1002: Syntax Error How to ...
These are the exact steps I followed to get my app running in development mode on my local machine. Step 1. Install react-app-polyfill...
Read more >
Syntax error 'SCRIPT1002' using internet explorer 11
First google result for me has some things to try, SCRIPT1002: Syntax error - IE11 - Polyfill - Development Mode · Issue #6924 ......
Read more >
IE11 browser: getting SCRIPT1002 Syntax Error in React App
Been trying to make my React app work with IE11 with not luck so far. Getting the error: > SCRIPT1008: Syntax error sso.bundle.js...
Read more >
Syntax Error In Ie 11 For This Node_Moduels - ADocLib
Syntax error 'SCRIPT1002' using internet explorer 11 Hi everyone. I am getting this error on IE 11. This is my package.json. I already...
Read more >
Is your Vue app not working in IE 11? Here's how to fix it.
SCRIPT1002 : Syntax error; SCRIPT5022: Exception thrown and not caught; SCRIPT438: Object doesn't support property or method 'defineProperty' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found