您好我正在尝试使用Webpack 4.1.1,每次我使用Google Fetch的网站查看Google如何查看我的页面时,我都会看到一个空白屏幕。好。所以我安装了Rollbar以查看是否可以收到错误。 Rollbar告诉我:
TypeError: undefined is not a function
1
File "webpack:///webpack/bootstrap" line 111 col 1 in e
if (!me.children.includes(request)) me.children.push(request);
2
File "webpack:///../node_modules/history/PathUtils.js" line 60 col 1 in Object.<anonymous>
return path;
3
File "webpack:///webpack/bootstrap" line 743 col 1 in M
modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
4
File "webpack:///webpack/bootstrap" line 863 col 1 in [anonymous]
return hotCreateRequire(140)(__webpack_require__.s = 140);
5
File "webpack:///webpack/bootstrap" line 863 col 1 in [anonymous]
return hotCreateRequire(140)(__webpack_require__.s = 140);
从我收集的内容来看,它抱怨Webpack的引导代码。所以我在Chrome 64和FF 58.02中测试了我的代码。没有问题。就我收集而言,Webpack看起来像我的代码与旧浏览器不兼容。 - 我已经安装了babel-polyfill,whatwg-fetch,promise-polyfill没有运气。那么也许我在Webpack编译代码时没有做正确的事情?或者这是Webpack的错误吗?
.babelrc
{
"sourceMaps": true,
"presets": [
["env", {
"targets": {
"browsers": ["last 4 versions", "chrome >= 41"]
}
}],
"stage-0"
],
"plugins": [
["transform-decorators-legacy"],
["transform-class-properties"],
["syntax-async-functions"],
["transform-react-jsx", { "pragma": "h" }]
]
}
输入应用文件。
import 'whatwg-fetch';
import 'babel-polyfill';
import 'promise-polyfill';