簡體   English   中英

IE11中的Script1014無效字符錯誤

[英]Script1014 Invalid character error in IE11

當我嘗試在IE11中打開我的react項目時,出現錯誤“ SCRIPT1014無效字符”。 並且所有其他瀏覽器甚至可以完美運行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' },
    ),
  ],
};

我嘗試了以下對我沒有幫助的問題的解決方案:

與IE11反應不正常,顯示黑屏

IE11拋出“ SCRIPT1014:無效字符”,所有其他瀏覽器均在該處工作

任何幫助,將不勝感激。 提前致謝。

我的錯。 我使用的是IE中不支持的'flexbox-polyfills'軟件包。 因此,我刪除了此軟件包,並在webpack.config.js文件中添加了“ babel-polyfill”軟件包及其配置。

它解決了我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM