我的React + Webpack应用程序在开发模式下在Chrome和FF中正常运行,但在IE11中运行不正常。我也使用了babel-polyfill,但它没有用。
有两个主要问题:beblow:
警告:道具类型失败:提供给children
的道具HashRouter
无效,需要一个ReactNode。
SCRIPT5022:未知浏览器:( 这个问题指出bundle.js中的错误如下:
if (isChrome()) {
regex = /^ +at.+\((.*):([0-9]+):([0-9]+)/;
expected_fields = 4;
// (skip first line containing exception message)
skip_lines = 1;
} else if (isFirefox()) {
regex = /@(.*):([0-9]+):([0-9]+)/;
expected_fields = 4;
skip_lines = 0;
} else {
throw new Error("unknown browser :(");
}
此代码表示当我使用IE时,将抛出错误unknow browser :(
。但为什么我的bundle.js中有这些代码?我不知道如何解决这类问题。我搜索了很久,但遗憾的是没有找到相关的答案。
以下是项目依赖项:
"dependencies": {
"antd": "^2.11.0",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babelify": "^7.3.0",
"css-loader": "^0.25.0",
"fetch": "^1.1.0",
"history": "^4.6.1",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-hot-loader": "^3.0.0-beta.7",
"react-mixin": "^2.0.2",
"react-responsive": "^1.3.0",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"style-loader": "^0.13.1"
},
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-import": "^1.2.1",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"url-loader": "^0.5.9",
"webpack": "^2.6.0",
"webpack-dev-server": "^2.4.5"
},
有没有人遇到同样的问题,任何建议都会非常感激。