1

When I'm trying to open my react project in IE11, I get the error 'SCRIPT1014 Invalid Character'. And every other browser works perfectly even the Edge. I have tried using 'core.js', 'babel-polyfills', 'babel-plugin-transform-class-properties'.

Here is my webpack.config.js file:

// webpack v4
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');


module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, '/dist'),
    filename: 'index_bundle.js',
    publicPath: '/',

  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
        },
      },
      {
        test: /\.styl$/,
        exclude: /node_modules/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: ['css-loader', 'postcss-loader', 'stylus-loader'],
        }),
      },
      {
        test: /\.(png|jp(e*)g|svg|woff|woff2|eot|ttf|otf)$/,
        use: [{
          loader: 'url-loader',
          options: {
            limit: 8000, // Convert images < 8kb to base64 strings
            name: 'images/[hash]-[name].[ext]',
          },
        }],
      },
    ],
  },
  devServer: {
    port: 8881,
    host: '0.0.0.0',
    historyApiFallback: true,
  },
  watch: true,
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
    }),
    new ExtractTextPlugin(
      { filename: 'app.bundle.css' },
    ),
  ],
};

I tried solutions from the questions below which did not help me:

react with IE11 is not working, displaying blank screen

IE11 throwing “SCRIPT1014: invalid character” where all other browsers work

Any help would be appreciated. Thanks in advance.

Hitesh Chaudhari
  • 705
  • 1
  • 7
  • 12

1 Answers1

0

My mistake. I was using the package 'flexbox-polyfills' which is not supported in the IE. So, I removed this package and added the 'babel-polyfill' package and its configuration in the webpack.config.js file.

It solved my problem.

Hitesh Chaudhari
  • 705
  • 1
  • 7
  • 12