嗨,我正在尝试使用 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';