【发布时间】: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