I have problem with Safari version <= 9. Babel doesn't seem to replace const with var.
I get this error in console:
Unexpected keyword 'const'. Const declarations are not supported in strict mode.
I tried using @babel/preset-stage-0 but babel removed it.
This is my app configuration:
.babelrc
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-object-assign"
]
}
webpack.config.js
const path = require("path");
const webpack = require("webpack");
const componentName = "contact-captain";
const publicFolderRelativePath = "../../../../public/js";
const ignorePlugin = new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/);
module.exports = {
// devtool: "source-map",
output: {
path: path.resolve(__dirname, publicFolderRelativePath),
filename: `${componentName}.js`
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
},
plugins: [
ignorePlugin
]
};
did you try to configure preset-env
?
you can find the browsers list here: https://github.com/browserslist/browserslist
probably need to add Safari 8
in your list...
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions"],
}
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With