I have some trouble with IE11 and a static javascript class I wrote.
The error I get is:
SCRIPT1002: Syntax error
rgmui.box.js (6,1)
Which points to:
// ===========================================
// RGMUI BOX
// Static class
class RgMuiBox {
^
So I’m guessing I’m defining this class in the wrong way? What’s the correct way of doing this?
I found a post on SO that seems to point out that the issue is ES5 vs ES6 — and I figure IE11 doesn’t support ES6?
Just to be complete, this is what I have (simplified):
class RgMuiBox {
static method1() {
// .. code ..
}
}
Thanks!
asked May 12, 2016 at 17:54
1
Hate to reopen such an old issue, but it still shows up high in the results, so I’ll add what I found out:
To reiterate what @Mikey and @REJH said, classes are not recognized by IE11.
That said, tools like Babel will allow you to translate classes into something that will run on IE11.
answered Sep 18, 2017 at 16:17
user8576017user8576017
4765 silver badges4 bronze badges
2
@Mikey is right. IE11 does not recognize this syntax for classes because ES6 spec:
https://kangax.github.io/compat-table/es6/
class RgMuiBox {
static method1() {
// .. code ..
}
}
I’m still not sure if the following is the correct way to define a static class but it works:
var RgMuiBox = {};
RgMuiBox.method = function() {
// ....
}
Just putting it out here so this question has some sort of an answer that might help people get going. If there are alternatives to the above I like to hear about those!
answered Aug 16, 2016 at 14:03
REJHREJH
3,2134 gold badges29 silver badges55 bronze badges
Static class Example
var _createClass = (function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var StaticClass = (function () {
function StaticClass() {
_classCallCheck(this, StaticClass);
}
_createClass(StaticClass, null, [{
key: "method1",
value: function method1() {
// .. code ..
}
}]);
return StaticClass;
})();
![]()
Ed Randall
6,5941 gold badge50 silver badges43 bronze badges
answered Mar 8, 2018 at 4:59
![]()
Negi RoxNegi Rox
3,7981 gold badge10 silver badges17 bronze badges
0
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(R) Xeon(R) 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:)
- Create a new create-react-app project following the steps provided by the user guides
- browse to website on chrome and see it working perfectly.
- 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

Website On Chrome:

Website on IE11:



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)
- docker-compose build
- docker-compose up -d
- docker exec -it practice bash
- cd src
- vi index.js
- add the two polyfill lines to the top of index.js
- save and quit vi
- go to the webpage on IE11.
- Remove From My Forums
-
Question
-
User-1359505260 posted
Hi,
I’m seeing
SCRIPT1002: Syntax error
leftpane.aspx,
line 1 character 30in my aspx page in IE10. I don’t see any issues in IE9 or previous versions.
Below I have posted the aspx source code. Am I missing anything here? Please help me.
Thanks
<%@ Page language="c#" AutoEventWireup="false" %> <%@Import Namespace="System.Globalization"%> <%@Import Namespace="System.Resources"%> <%@Import Namespace="System.Reflection"%> <% Assembly a = Assembly.Load("WebClientResources"); ResourceManager rm = new ResourceManager("WebClientResources", a); %> <!DOCTYPE html> <HEAD> <META NAME="GENERATOR" Content="Microsoft FrontPage 5.0"> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="scripts/menu.js"></SCRIPT> <LINK REL="stylesheet" HREF="webclient.css"> <TITLE></TITLE> <SCRIPT LANGUAGE="javascript"> var ALL_PATHS = '<%=rm.GetString("ALL_PATHS")%>'; var NETWORK_VIEW = '<%=rm.GetString("NETWORK_VIEW")%>'; var FOLDER_VIEW = '<%=rm.GetString("FOLDER_VIEW")%>'; var ACCESS_EVENTS = '<%=rm.GetString("ACCESS_EVENTS")%>'; var ADVANCED_SEARCH = '<%=rm.GetString("ADVANCED_SEARCH")%>'; var ADVANCED = '<%=rm.GetString("ADVANCED")%>'; var POINT_TYPES = '<%=rm.GetString("POINT_TYPES")%>'; var AREAS = '<%=rm.GetString("AREAS")%>'; var ACCESS_DIST_EVENTS = '<%=rm.GetString("ACCESS_DISTRIBUTION_EVENTS")%>'; var NEW_PERSON = '<%=rm.GetString("NEW_PERSON")%>'; var NEW_REPORT = '<%=rm.GetString("NEW_REPORT")%>'; var TOGGLE_CONTENTS = '<%=rm.GetString("SHOW/HIDE_CONTENTS")%>'; var ALL_OBJECTS = '<%=rm.GetString("ALL_OBJECTS")%>'; var CX_WEBS = '<%=rm.GetString("WEB_PAGES")%>'; var EVENT_VIEWS = '<%=rm.GetString("EVENT_VIEWS")%>'; var GRAPHICS = '<%=rm.GetString("GRAPHICS")%>'; var GROUPS = '<%=rm.GetString("GROUPS")%>'; var PERSONNEL = '<%=rm.GetString("PERSONNEL")%>'; var POINTS = '<%=rm.GetString("POINTS")%>'; var REPORTS = '<%=rm.GetString("REPORTS")%>'; var SCHEDULES = '<%=rm.GetString("SCHEDULES")%>'; var SHOWALL = '<%=rm.GetString("SHOW_ALL")%>'; var VIDEO = '<%=rm.GetString("VIDEO")%>'; var DOORS = '<%=rm.GetString("DOORS")%>'; var TRENDLOGS = '<%=rm.GetString("TREND_LOGS")%>'; var LOOPS = '<%=rm.GetString("LOOPS")%>'; var USER = '<%=rm.GetString("USER")%>'; var ANALOG_INPUT = '<%=rm.GetString("ANALOGINPUT")%>'; var ANALOG_OUTPUT = '<%=rm.GetString("ANALOGOUTPUT")%>'; var ANALOG_VALUE = '<%=rm.GetString("ANALOGVALUE")%>'; var BINARY_INPUT = '<%=rm.GetString("BINARYINPUT")%>'; var BINARY_OUTPUT = '<%=rm.GetString("BINARYOUTPUT")%>'; var BINARY_VALUE = '<%=rm.GetString("BINARYVALUE")%>'; var MULTISTATE_INPUT = '<%=rm.GetString("MULTISTATEINPUT")%>'; var MULTISTATE_OUTPUT = '<%=rm.GetString("MULTISTATEOUTPUT")%>'; var MULTISTATE_VALUE = '<%=rm.GetString("MULTISTATEVALUE")%>'; var INFINITY_INPUT = '<%=rm.GetString("INFINITYINPUT")%>'; var INFINITY_OUTPUT = '<%=rm.GetString("INFINITYOUTPUT")%>'; var INFINITY_NUMERIC = '<%=rm.GetString("INFINITYNUMERIC")%>'; var INFINITY_DATETIME = '<%=rm.GetString("INFINITYDATETIME")%>'; var INFINITY_STRING = '<%=rm.GetString("INFINITYSTRING")%>'; var SELECT_AT_LEAST_ONE = '<%=rm.GetString("MUST_HAVE_ONE_POINT_TYPE_SELECTED")%>'; var REFRESH = '<%=rm.GetString("REFRESH")%>'; var True = true; var False = false; var bShowingMenu = false; var bExploreMode = false; var bNetworkView = false; var bFolderView = false; var bAllView = true; var winMain = window.top; var bSplitEditorPage = false; var sFilterType = ALL_OBJECTS; var sCustomFilter = ''; var AccessEventsLink = '<%=Session["ACCESSEVENTS"]%>'; var AccessDistEventsLink = '<%=Session["ACCESSDISTEVENTS"]%>'; var AreasLink = '<%=Session["AREAS"]%>'; /////////////////////////////////////////////////////////////////////// // Preload Images var imgArrowUp = new Image(); imgArrowUp.src = "images/arrow_up.gif"; var imgArrowDown = new Image(); imgArrowDown.src = "images/arrow_down.gif"; /////////////////////////////////////////////////////////////////////// var fExplore = <%=(bool)Session["EXPLORE"] %>; function doLoad(){ writeMenus(); if(fExplore) DoExplore(); else DoSearch(); } /////////////////////////////////////////////////////////////////////// function DoTimeout(){ window.location.href="logOff.aspx?Type=Timeout"; } ////////////////////////////////////////////////////////////////////// function TogglePointsDiv(){ if(document.getElementById("PointsDiv").style.display == 'none'){ document.getElementById("PointsDiv").style.display = ''; }else{ document.getElementById("PointsDiv").style.display = 'none'; } if(bExploreMode){ document.getElementById("PointsRefresh").style.display = ''; } else{ document.getElementById("PointsRefresh").style.display = 'none'; } } ////////////////////////////////////////////////////////////////////// function SetFilter(sFilter){ var strClass = ''; var SubMenuHTML = ''; var s=''; var i=0; switch (sFilter){ case GRAPHICS: strClass='142'; break; case REPORTS: if(AccessDistEventsLink!=''){ s = '<a href="' + AccessDistEventsLink + '" class="mainHeader3Link">' + ACCESS_DIST_EVENTS + '</a>'; ++i; } if(AccessEventsLink!=''){ if(i>0) s += '<br>'; s += '<a href="' + AccessEventsLink + '" class="mainHeader3Link">' + ACCESS_EVENTS + '</a>'; ++i; } if(AreasLink!=''){ if(i>0) s += ' | '; s += '<a href="' + AreasLink + '" class="mainHeader3Link">' + AREAS + '</a>'; ++i; } if(i>0) s += ' | '; var URL; URL = window.top.NewReportPage + '?user=' + window.top.getCookie('USERNAME') + '&VD=' + window.top.VirDirName + '&Protocol=' + window.location.protocol ; s += '<a href="javascript:window.top.OpenEditor('' + URL + '', 0, 0, ' + ''' + NEW_REPORT + '');" class="mainHeader3Link">' + NEW_REPORT + '</a>'; SubMenuHTML = s; strClass='172,155'; break; case SCHEDULES: strClass='6,17'; //6=calendar, 17=schedule SubMenuHTML=s; break; case EVENT_VIEWS: strClass='164'; break; case GROUPS: strClass='11'; break; case PERSONNEL: strClass='137'; s = '<a href="javascript:window.top.OnNewPersonnelObject()" class="mainHeader3Link">' + NEW_PERSON + '</a>'; s += ' | <a href="javascript:window.top.DoAdvancedPersonnelSearch(true)" class="mainHeader3Link">' + ADVANCED_SEARCH + '</a>'; SubMenuHTML=s; break; case POINTS: strClass = window.top.getCookie("PointsFilter"); if(!strClass) strClass = '0,1,2,3,4,5,13,14,19,257,259,260,261,263'; s = '<a href="javascript:TogglePointsDiv()" class="mainHeader3Link">' + POINT_TYPES + '</a>'; SubMenuHTML=s; break; case USER: strClass='141'; s = '<a href="javascript:window.top.OnNewUser()" class="mainHeader3Link">' + "New User" + '</a>'; SubMenuHTML=s; break; case VIDEO: strClass='171'; break; case CX_WEBS: strClass='241'; break; case ALL_OBJECTS: strClass = ''; break; case DOORS: strClass='266'; break; case LOOPS: strClass='12'; break; case TRENDLOGS: strClass='20'; break; default: } if(sFilter != POINTS) document.getElementById("PointsDiv").style.display = 'none'; winMain.setCookie("ClassFilter", strClass) winMain.setCookie("FilterType", sFilter) //we need to tell the app to show the home page and not the //infinity controller's contents if it's a CXWeb filter if(!bExploreMode){ //search mode var strQSParam = ''; if (sFilter == CX_WEBS) strQSParam = '?CXWebs=true&'; else strQSParam = '?'; ExploreNav(winMain.SearchPage + strQSParam + 'Filter=' + strClass + '&INC=Search&Type=QP&SearchPathID=' + window.top.getCookie("SearchFolderID")); winMain.bShowingContentWindow=false; }else{ // explore mode var sPage; var sFolderNetworkBacnetAll; var url='<a class="mainHeader3Link" onclick="bAllView=true;bNetworkView=false;bFolderView=false;window.top.setCookie('BrowseType', 'All');" href="javascript:winMain.NavExplorePanes()">'; url += ALL_PATHS + '</a> '; url += '<a class="mainHeader3Link" onclick="bFolderView=true;bAllView=false;bNetworkView=false;window.top.setCookie('BrowseType', 'Folder');" href="javascript:winMain.NavExplorePanes()">'; url += FOLDER_VIEW + '</a> '; url += '<a class="mainHeader3Link" onclick="bNetworkView=true;bFolderView=false;bAllView=false;window.top.setCookie('BrowseType', 'Network');" href="javascript:winMain.NavExplorePanes()">'; url += NETWORK_VIEW + '</a>'; if(SubMenuHTML) SubMenuHTML = '<hr>' + SubMenuHTML; SubMenuHTML = url + SubMenuHTML; if(bNetworkView){ sPage=winMain.NetworkBrowsePage; sFolderNetworkBacnetAll = "Network"; } if(bFolderView){ sPage=winMain.FolderBrowsePage; sFolderNetworkBacnetAll = "Folder"; } if(bAllView){ sPage=winMain.AllPathBrowsePage; sFolderNetworkBacnetAll = "All" } document.frames["exploreIFrame"].location.href = "ExploreFrameset.htm"; winMain.bShowingContentWindow=false; if (sFilter == CX_WEBS) strQSParam = '?CXWebs=true&'; else strQSParam = '?'; var strQSParam = strQSParam + 'Filter=' + strClass; var idHi = window.top.getCookie("BrowseIdHi"); var idLo = window.top.getCookie("BrowseIdLo"); if(idHi=='') idHi = '0'; if(idLo=='') idLo = '0'; if(sFolderNetworkBacnetAll=="") sFolderNetworkBacnetAll = getCookie("BrowseType"); if(sFolderNetworkBacnetAll=="") sFolderNetworkBacnetAll = "All"; } SetSubMenu(SubMenuHTML); sFilterType = sFilter; document.getElementById("MainMenu").innerHTML = sFilter; } /////////////////////////////////////////////////////////////////////// function ToggleContents(){ var bShow = window.top.bShowingContentWindow; window.top.HideWindow(bShow, "content"); } /////////////////////////////////////////////////////////////////////// function ShowMenu(bShow){ bShowingMenu = bShow; if(bShow==true){ document.getElementById("MenuArrow").src = imgArrowUp.src; if(bExploreMode==false) winMain.frames['leftpane'].frames['exploreIFrame'].document.getElementById('SearchComboDiv').style.display='none'; popOver(0,1,true); } else { popOut(0,1); document.getElementById("MenuArrow").src = imgArrowDown.src; if(bExploreMode==false) winMain.frames['leftpane'].frames['exploreIFrame'].document.getElementById('SearchComboDiv').style.display=''; } } function ToggleMenu(){ ShowMenu(!bShowingMenu); } /////////////////////////////////////////////////////////////////////// function ToggleView(DivName){ if(document.getElementById(DivName).style.display=='none') document.getElementById(DivName).style.display='' else document.getElementById(DivName).style.display='none' } /////////////////////////////////////////////////////////////////////// function SetSubMenu(sHTML){ document.getElementById("ExploreSubMenu").innerHTML = sHTML; } /////////////////////////////////////////////////////////////////////// function DoSearch(){ if(bShowingMenu) ShowMenu(false) if(bExploreMode==true || fExplore==false){ bExploreMode = false; SetFilter(sFilterType); document.getElementById("PointsRefresh").style.display = 'none'; } } /////////////////////////////////////////////////////////////////////// function DoExplore(){ if(bShowingMenu) ShowMenu(false) if(bExploreMode==false){ bExploreMode = true; } SetFilter(sFilterType); document.getElementById("PointsRefresh").style.display = ''; // Pristine - 02/12/2008 - Muthuraja I - Lines added for defect #18993 ('Wrong Explore and Search .gif files displayed after clicking Parent Path in Search pane) //-------------------------Start--------------------------- var imgExploreOn = new Image(); imgExploreOn.src = "images/browse_on.gif"; var imgSearchOff = new Image(); imgSearchOff.src = "images/search.gif"; parent.frames['topmenu'].document.getElementById("searchImage").src = imgSearchOff.src; parent.frames['topmenu'].document.getElementById("exploreImage").src = imgExploreOn.src; //-------------------------End------------------------------ } /////////////////////////////////////////////////////////////////////// function ExploreNav( href ){ document.frames["exploreIFrame"].document.body.style.cursor = "wait"; document.frames["exploreIFrame"].location.href = href; } /////////////////////////////////////////////////////////////////////// var menu = new Array(); //var defOver = '#9DA4AA', defBack = '#9DA4AA';// var defOver = '#558CBE', defBack = '#78a0c8';// var defLength = 30; menu[0] = new Array(); menu[0][0] = new Menu(true, '', 0, 0, 200, '', '', '', 'headerText'); menu[0][1] = new Item('', '#', '5', 26, 0, 1); menu[1] = new Array(); menu[1][0] = new Menu(true, '', 0, 17, 260, defOver, defBack, 'itemBorder', 'itemText'); //Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) <%=Session["MENU"]%> </SCRIPT> </HEAD> <BODY leftmargin="0" topmargin="0" rightmargin="0" onload="doLoad()" vlink="#d7e6f0" alink="#ffffff" class="mainHeader3"> <table class="mainHeader3" id="exploreTable" border="0" cellpadding="3" cellspacing="0" height="100%" width="100%"> <tr> <td id="exploreMenuTD" valign="middle" height="30" class="mainHeader2" nowrap> <span id="MainMenu" class="itemText"></span></td> <td valign="middle" align="right" height="30" class="mainHeader2" nowrap><a href="javascript:ToggleMenu()"><IMG src="images/Arrow_Down.gif" id="MenuArrow" align="absMiddle" border="0"></a> </td> </tr> <tr> <td id="exploreSubmenuTD" height="1" class="mainHeader3" colspan="2" align="center" valign="middle"><span id="ExploreSubMenu"></span><SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="Scripts/PointSelection.js"></SCRIPT><img src="images/1x1.gif"></td> </tr> <tr> <td id="" colspan="2" class="mainHeader3" nowrap> <iframe id="exploreIFrame" name="exploreIFrame" src="about:blank" height="100%" style="WIDTH: 100%" frameborder="0" scrolling="yes"></iframe> </td> </tr> </table> </BODY> </HTML>
Answers
-
User-1818759697 posted
Hi,
When you encounter the error «Syntax error in IE 10», it can broadly be interpreted as:
there is some seriously illegal markup in your script (according to IE’s definition). So you could try the below ways:The script error will usually (unhelpfully) point to the end of the script definition, the </script> tag. Essentially, the best strategy I could come up with, to sift through your script and search for anything unusual. For instance:
- Does your JavaScript define new ‘<script></script>’ elements by using the exact string ‘<script>’
- Does your JavaScript markup resembling HTML/XML style comments, such as `<!–’ or ‘–>’
For more information, you could refer to:
http://maxrohde.com/2012/08/21/internet-explorer-script1002-syntax-error-help/
Besides, if your codes run fine in IE 9 or previous versions, you could add the below tag to force the IE to use IE 9 mode:
<head runat="server"> <meta http-equiv="X-UA-Compatible" content="IE=9" /> </head>For further details, you could access to:
http://stackoverflow.com/questions/3449286/force-ie-compatibility-mode-off-in-ie-using-tags
Regards
-
Marked as answer by
Thursday, October 7, 2021 12:00 AM
SCRIPT1002: Syntax error
vendor.js (69467,1922)
When i run my app on IE browser it shows nothing and give above error.
Any help??
enter image description here
here is my angular version
+-- @angular-devkit/build-angular@0.6.8
| +-- html-webpack-plugin@3.2.0
| | `-- pretty-error@2.1.1
| | `-- renderkid@2.0.1
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| `-- node-sass@4.9.0
| +-- chalk@1.1.3
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| +-- npmlog@4.1.2
| | `-- gauge@2.7.4
| | +-- string-width@1.0.2
| | | `-- strip-ansi@3.0.1
| | | `-- ansi-regex@2.1.1 deduped
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| `-- sass-graph@2.2.4
| `-- yargs@7.1.0
| `-- cliui@3.2.0
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- @angular/compiler-cli@6.0.6
| `-- chokidar@1.7.0
| `-- UNMET OPTIONAL DEPENDENCY fsevents@1.2.4
| `-- UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.0
| `-- UNMET OPTIONAL DEPENDENCY npmlog@4.1.2
| `-- UNMET OPTIONAL DEPENDENCY gauge@2.7.4
| `-- UNMET DEPENDENCY strip-ansi@3.0.1
| `-- UNMET DEPENDENCY ansi-regex@2.1.1
+-- ansi-regex@2.1.1
+-- protractor@5.3.2
| `-- chalk@1.1.3
| +-- has-ansi@2.0.0
| | `-- ansi-regex@2.1.1 deduped
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- tslint@5.9.1
| `-- babel-code-frame@6.26.0
| `-- chalk@1.1.3
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
`-- webpack-dev-server@3.1.9
+-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1
`-- yargs@12.0.2
+-- cliui@4.1.0
| +-- strip-ansi@4.0.0
| | `-- ansi-regex@3.0.0
| `-- wrap-ansi@2.1.0
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
`-- string-width@2.1.1
`-- strip-ansi@4.0.0
`-- ansi-regex@3.0.0 deduped
npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1
![]()
ForestG
17k14 gold badges49 silver badges80 bronze badges
asked Oct 4, 2018 at 9:39
You need to include some compatibility JS files for internet explorer. Check out the official guide
There is also a polyfills.ts file in your project, check it out and uncomment what you need:
... uncomment from here
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
...
also, you you are developing for enterprise environment, you might need to turn off the Internet explorers default compatilibity modes as well, you can read more about that in this question
answered Oct 4, 2018 at 9:45
![]()
ForestGForestG
17k14 gold badges49 silver badges80 bronze badges
6
SCRIPT1002: Syntax error
vendor.js (69467,1922)
When i run my app on IE browser it shows nothing and give above error.
Any help??
enter image description here
here is my angular version
+-- @angular-devkit/build-angular@0.6.8
| +-- html-webpack-plugin@3.2.0
| | `-- pretty-error@2.1.1
| | `-- renderkid@2.0.1
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| `-- node-sass@4.9.0
| +-- chalk@1.1.3
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| +-- npmlog@4.1.2
| | `-- gauge@2.7.4
| | +-- string-width@1.0.2
| | | `-- strip-ansi@3.0.1
| | | `-- ansi-regex@2.1.1 deduped
| | `-- strip-ansi@3.0.1
| | `-- ansi-regex@2.1.1 deduped
| `-- sass-graph@2.2.4
| `-- yargs@7.1.0
| `-- cliui@3.2.0
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- @angular/compiler-cli@6.0.6
| `-- chokidar@1.7.0
| `-- UNMET OPTIONAL DEPENDENCY fsevents@1.2.4
| `-- UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.0
| `-- UNMET OPTIONAL DEPENDENCY npmlog@4.1.2
| `-- UNMET OPTIONAL DEPENDENCY gauge@2.7.4
| `-- UNMET DEPENDENCY strip-ansi@3.0.1
| `-- UNMET DEPENDENCY ansi-regex@2.1.1
+-- ansi-regex@2.1.1
+-- protractor@5.3.2
| `-- chalk@1.1.3
| +-- has-ansi@2.0.0
| | `-- ansi-regex@2.1.1 deduped
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
+-- tslint@5.9.1
| `-- babel-code-frame@6.26.0
| `-- chalk@1.1.3
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
`-- webpack-dev-server@3.1.9
+-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1
`-- yargs@12.0.2
+-- cliui@4.1.0
| +-- strip-ansi@4.0.0
| | `-- ansi-regex@3.0.0
| `-- wrap-ansi@2.1.0
| `-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1 deduped
`-- string-width@2.1.1
`-- strip-ansi@4.0.0
`-- ansi-regex@3.0.0 deduped
npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1
![]()
ForestG
17k14 gold badges49 silver badges80 bronze badges
asked Oct 4, 2018 at 9:39
You need to include some compatibility JS files for internet explorer. Check out the official guide
There is also a polyfills.ts file in your project, check it out and uncomment what you need:
... uncomment from here
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
...
also, you you are developing for enterprise environment, you might need to turn off the Internet explorers default compatilibity modes as well, you can read more about that in this question
answered Oct 4, 2018 at 9:45
![]()
ForestGForestG
17k14 gold badges49 silver badges80 bronze badges
6
HI,
I am facing an issue with the browser support in IE 11 of my reactjs project.
Here is my code sample.
package.json
{
"name": "my-project",
"version": "0.1.0",
"description": "",
"scripts": {
"start": "npm run dev",
"dev": "node_modules/.bin/webpack-dev-server",
"build": "node_modules/.bin/webpack --config webpack.config.prod.js"
},
"dependencies": {
"antd": "^3.26.7",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-import": "^1.11.0",
"classnames": "^2.2.6",
"connected-react-router": "^6.6.1",
"dotenv-webpack": "^1.7.0",
"es6-promise": "^4.2.8",
"formik": "^2.1.2",
"history": "^4.9.0",
"lodash": "^4.17.11",
"office-ui-fabric-react": "^7.83.2",
"prop-types": "^15.7.2",
"q": "^1.5.1",
"react": "^16.8.6",
"react-csv": "^1.1.2",
"react-dom": "^16.8.6",
"react-drag-listview": "^0.1.6",
"react-redux": "^7.1.3",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-select": "^3.0.8",
"react-table": "^6.9.0",
"reactjs-popup": "^1.5.0",
"redux": "^4.0.5",
"redux-auth-wrapper": "^3.0.0",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"xlsx": "^0.15.4",
"yup": "^0.28.0"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/polyfill": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"@types/history": "^4.7.2",
"@types/react": "^16.8.13",
"autoprefixer": "^9.5.1",
"autoprefixer-loader": "^3.2.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"clean-webpack-plugin": "^2.0.1",
"copy-webpack-plugin": "^5.0.2",
"cross-env": "^5.2.0",
"css-loader": "^2.1.1",
"dotenv": "^7.0.0",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"loader-utils": "^1.2.3",
"mini-css-extract-plugin": "^0.6.0",
"node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-loader": "^3.0.0",
"style-loader": "^0.23.1",
"stylelint": "^10.0.1",
"stylelint-config-standard": "^18.3.0",
"svg-sprite-loader": "4.1.3",
"uglifyjs-webpack-plugin": "^2.1.2",
"url-loader": "^1.1.2",
"webpack": "^4.30.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.3.1"
}
}
webpack.config.js
const path = require('path'); const webpack = require('webpack'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const Dotenv = require('dotenv-webpack'); require('dotenv').config(); const { NODE_ENV, HOST, PORT, CONNECTION_TYPE, APP_NAME, VERSION, THEME_COLOR, PROXY_URL, } = require('./webpack.constants'); const pathSource = path.resolve(__dirname, 'src'); const proxyConfig = PROXY_URL ? { proxy: { '/api/*': { target: PROXY_URL, pathRewrite: {'^/api/': ''}, changeOrigin: true, secure: false, logLevel: 'debug', proxyTimeout: 1e3 * 60 * 5, }, }, } : {}; module.exports = { context: pathSource, entry: ['@babel/polyfill', './App.js'], mode: NODE_ENV, output: { path: path.resolve(__dirname, 'build'), filename: 'bundle.js', chunkFilename: '[name].bundle.js', publicPath: '/', }, resolve: { modules: [path.resolve(__dirname, 'src'), 'node_modules'], }, module: { rules: [ { test: /.jsx?$/, exclude: path.resolve(__dirname, 'node_modules'), use: { loader: 'babel-loader', }, }, { test: /.css$/, use: [ 'style-loader', 'css-loader', 'postcss-loader', ], }, { test: /.less$/, exclude: /.module.less$/, use: [ 'style-loader', 'css-loader', 'postcss-loader', 'less-loader', ], }, { test: /.module.less$/, use: [ 'style-loader', { loader: 'css-loader', options: { sourceMap: true, modules: true, localIdentName: '[local]___[hash:base64:5]', }, }, 'postcss-loader', 'less-loader', ], }, { test: /.(ico)$/i, loader: 'file-loader', options: { name: '[name].[ext]', }, }, { test: /.pdf$/i, loader: 'file?name=[path][name].[ext]', }, { test: /.(jpe?g|png|gif|mp4)$/i, loader: 'url-loader', options: { name: '[path][name]-[sha512:hash:base64:4].[ext]', limit: 16384, }, }, { test: /.(woff|woff2|eot|ttf|svg)(?.*$|$)/, loader: 'file-loader', options: { name: '[path][name].[ext]', }, }, ], }, optimization: { minimize: false, nodeEnv: NODE_ENV, }, plugins: [ new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin(), new webpack.ProvidePlugin({}), new HtmlWebpackPlugin({ template: './index.html', filename: 'index.html', themeColor: THEME_COLOR, version: VERSION, projectName: APP_NAME, }), new MiniCssExtractPlugin({ filename: 'bundle.css', }), new CopyWebpackPlugin([{ from: 'assets/images', to: 'images', }]), new Dotenv(), new CleanWebpackPlugin(), new webpack.IgnorePlugin(/^./locale$/, /moment$/), ], devtool: 'source-map', devServer: { port: PORT, host: HOST, disableHostCheck: true, historyApiFallback: true, hot: true, overlay: true, https: CONNECTION_TYPE === 'https', stats: { assets: false, children: false, colors: true, entrypoints: false, env: true, modules: false, moduleTrace: false, }, ...proxyConfig, }, };
webpack.constant.js
module.exports = {
NODE_ENV: process.env.NODE_ENV || 'development',
HOST: process.env.HOST || 'localhost',
PORT: process.env.PORT || 3000,
CONNECTION_TYPE: process.env.CONNECTION_TYPE || 'http',
APP_NAME: process.env.APP_NAME || 'Application',
VERSION: process.env.VERSION || '0.1',
THEME_COLOR: process.env.THEME_COLOR || '#000000',
PROXY_URL: process.env.PROXY_URL || false,
};
When i do npm start every things works perfectly, But when i tries to run the project on IE11, It gives me below error under bundle.js at this specified line:
function encoderForArrayFormat(options) { switch (options.arrayFormat) { case 'index': return key => (result, value) => { const index = result.length; if (value === undefined || (options.skipNull && value === null)) { return result; } if (value === null) {
What I have tried:
i have tried changing versions of webpack , @wabpack/polyfill and babel-loader. but its not working. Same error i am facing in IE 11.
Is there i am missing something? Please give some suggestion i can try.