I am setting up a React app with babel and webpack. The app works fine on chrome and other browsers except internet exlorer11.
Here is my package.json
{
"name": "xai",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"webpack": "webpack",
"start": "webpack serve"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all",
"not ie < 11",
"ie 11"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
"ie 11"
]
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/node": "^7.14.2",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/preset-env": "^7.14.4",
"@babel/preset-react": "^7.13.13",
"@fortawesome/fontawesome-free": "^5.15.3",
"babel-loader": "^8.2.2",
"css-loader": "^5.2.6",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.1",
"image-webpack-loader": "^7.0.1",
"path": "^0.12.7",
"style-loader": "^2.0.0",
"webpack": "^5.38.1",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
},
"dependencies": {
"@material-ui/core": "^4.11.4",
"axios": "^0.21.1",
"bootstrap": "^5.0.1",
"copy-to-clipboard": "^3.3.1",
"fast-text-encoding": "^1.0.3",
"firebase": "^8.6.3",
"font-awesome": "^4.7.0",
"font-awesome-webpack": "0.0.5-beta.2",
"gh-pages": "^3.2.0",
"history": "^5.0.0",
"hookrouter": "^1.2.5",
"lodash": "^4.17.21",
"markdown-loader": "^6.0.0",
"max-validator": "^1.2.1",
"node-sass": "^6.0.0",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-animations": "^1.0.0",
"react-app-polyfill": "^2.0.0",
"react-beforeunload": "^2.5.1",
"react-beforeunload-component": "^1.2.3",
"react-dom": "^17.0.2",
"react-likert-scale": "^4.1.1",
"react-radio-buttons": "^1.2.2",
"react-router-dom": "^5.2.0",
"react-toastify": "^7.0.4",
"react-tooltip": "^4.2.21",
"reactstrap": "^8.9.0",
"sass-loader": "^11.1.1",
"url-loader": "^4.1.1",
"uuid": "^8.3.2"
}
}
And webpack.config.js
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: path.join(__dirname, "src", "index.js"),
output: { path: path.join(__dirname, "build"), filename: "index.bundle.js" },
mode: process.env.NODE_ENV || "development",
resolve: {
modules: [path.resolve(__dirname, "src/"), "node_modules"],
extensions: ["*", ".js", ".jsx", ".json"],
symlinks: false,
cacheWithContext: false,
},
devServer: { contentBase: path.join(__dirname, "src") },
module: {
rules: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "url-loader?limit=10000&mimetype=application/font-woff",
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "file-loader",
},
{ test: /\.md$/, use: "raw-loader" },
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.(css|scss)$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(jpg|jpeg|png|gif|mp3|svg)$/,
use: ["file-loader"],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "index.html"),
}),
],
};
and I use this config for .babelrc
{
"presets": ["@babel/preset-env", "@babel/react"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
The problem is that I used to have the app load(with broken routing when I use CRA). Now I only get a blank page with SCRIPT1006: Expected '('. I am wondering if you could have a workaround to solve this error