【问题标题】:Script1014 Invalid character error in IE11Script1014 IE11 中的无效字符错误
【发布时间】:2018-11-09 09:57:41
【问题描述】:

当我尝试在 IE11 中打开我的 react 项目时,我收到错误“SCRIPT1014 Invalid Character”。 其他所有浏览器都可以完美运行,即使是 Edge。 我试过使用'core.js'、'babel-polyfills'、'babel-plugin-transform-class-properties'。

这是我的 webpack.config.js 文件:

// 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' },
    ),
  ],
};

我尝试了以下问题的解决方案,但对我没有帮助:

react with IE11 is not working, displaying blank screen

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

任何帮助将不胜感激。提前致谢。

【问题讨论】:

    标签: reactjs internet-explorer webpack babeljs


    【解决方案1】:

    我的错。我使用的是 IE 不支持的包 'flexbox-polyfills'。 所以,我删除了这个包,并在 webpack.config.js 文件中添加了 'babel-polyfill' 包及其配置。

    它解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多