https://bitbucket.org/IamHttP/webpack-dev-server-ie11/src
npm start should start the dev server, which should be safe for IE11
missing wrappers around pieces of code make the code fail in IE11, specifically reserved words
Start the repro
In the repo I've linked, there are two things of interest.
The code inside /src/index.js has a the following lines:
let createDebug = {};
createDebug.default = true;
when starting the dev server, the code (main.js) has the following output
var createDebug = {};
createDebug["default"] = true;
However, if you search for "createDebug.default" in main.js, you'll find some more occurrences.
since 'default' is a reserved word, IE11 throws an exception.
the code createDebug.default is inserted by (I think) webpack-dev-server, or by some inner dependency.
Since babel obviously works (renamed .default to ["default"]), it seems babel is not running on the webpack-dev-server code, or it's bundle.
You need setup babel for IE11, it is problem on babel level, you can create browserslist, latest version of webpack works since IE9
For future folk, browserslist does not fix this issue.
This is also a problem with create-react-app, with exactly the same symptoms (createDebug.default being the source code).
From what I've seen create-react-app does not support IE11 in development mode.
as discussed here:
https://github.com/facebook/create-react-app/issues/5832#issuecomment-464171624
I think this related to some node_modules not being transpiled by babel, and one of the suggestions is to transpile them manually, or maybe open issues in the offending packages.
I tried forcing babel to transpile node_modules but couldn't get it to work.
@evilebottnawi - Is there an example setup of webpack-dev-server that works for IE11?
Most helpful comment
For future folk, browserslist does not fix this issue.
This is also a problem with create-react-app, with exactly the same symptoms (createDebug.default being the source code).
From what I've seen create-react-app does not support IE11 in development mode.
as discussed here:
https://github.com/facebook/create-react-app/issues/5832#issuecomment-464171624
I think this related to some node_modules not being transpiled by babel, and one of the suggestions is to transpile them manually, or maybe open issues in the offending packages.
I tried forcing babel to transpile node_modules but couldn't get it to work.
@evilebottnawi - Is there an example setup of webpack-dev-server that works for IE11?