I faced similar issue and that's what I found out. Setting up the debug
option in .babelrc
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "IE >= 8"]
},
"debug": true
}]
]
}
shows that browsering works:
Using targets: { "chrome": "61", "android": "4.4.3", "edge":
"15", "firefox": "56", "ie": "8", "ios": "10.3", "safari":
"10.1" }
Modules transform: commonjs
Using plugins: check-es2015-constants {"android":"4.4.3","ie":"8"}
transform-es2015-arrow-functions {"android":"4.4.3","ie":"8"}
transform-es2015-block-scoped-functions {"android":"4.4.3","ie":"8"}
transform-es2015-block-scoping {"android":"4.4.3","ie":"8"}
transform-es2015-classes {"android":"4.4.3","ie":"8"}
transform-es2015-computed-properties {"android":"4.4.3","ie":"8"}
transform-es2015-destructuring
{"android":"4.4.3","edge":"15","ie":"8"}
transform-es2015-duplicate-keys {"android":"4.4.3","ie":"8"}
transform-es2015-for-of {"android":"4.4.3","ie":"8"}
transform-es2015-function-name
{"android":"4.4.3","edge":"15","ie":"8"}
...
My webpack config looks just
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
}
But that does not solve all the problems. Investigating the transpiled distributive, I could not find some expected things like polyfill for Array.prototype.reduce
that should be polyfilled for IE 8. But the idea is (as I can understand) that it is not the responsibility of the babel-core
transpiler. And we need to use babel-polyfill or core-js. So polyfilling in a webpack configuration is a separate task and setting up browsers
option in .babelrc
is just a part the story.
See also related topics on the GitHub and on StackOverflow.