很难追踪到这一点,所以谢谢你的忍耐。一些用户抱怨我们的网站在IE11中崩溃了。这款应用使用的是nextjs 3.0.1和webpack 2.7.0。
在开发模式下调试
我想我有一个类似于Angular RxJs timer pausing on IE11的问题。在IE11中,我从名为webpack/webpack引导x(其中x是一些十六进制数字)的引用中得到一个错误。
下面是导致这个问题的函数:
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
if(installedModules[moduleId]) {
return installedModules[moduleId].exports;
}
// Create a new module (and put it into the cache)
var module = installedModules[moduleId] = {
i: moduleId,
l: false,
exports: {},
hot: hotCreateModule(moduleId),
parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),
children: []
};
// Execute the module function
var threw = true;
try {
modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
threw = false;
} finally {
if(threw) delete installedModules[moduleId];
}
// Flag the module as loaded
module.l = true;
// Return the exports of the module
return module.exports;
}行modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));抛出错误Unable to get property 'call' of undefined or null reference。
我认为这是由于缺少polyfill造成的,所以我听从了https://github.com/zeit/next.js/issues/1254的建议,将以下内容添加到next.config.js (下一步的webpack配置):
const originalEntry = config.entry
config.entry = function () {
return originalEntry()
.then((entry) => {
Object.keys(entry).forEach(k => {
entry[k].unshift('babel-polyfill')
})
console.log(entry)
return entry
})
}我仍然看到同样的错误。
生产中的其他详细信息
有趣的是,我在nextjs应用程序的生产版本中遇到了一个不同的问题。它位于next生成的app.js文件的深层,但错误似乎来自这行https://github.com/ianstormtaylor/heroku-logger/blob/master/src/index.js#L12
const {
LOG_LEVEL,
NODE_ENV,
} = process.env它正在抛出Expected identifier。这是因为模块没有正确地从ES6转换到ES5吗?这可能是一个潜在的问题(我在开发中看到的),而不是heroku-logger库的问题。
意识到这是一个复杂的问题,我可能遗漏了一些细节。提前感谢您的帮助!
发布于 2017-07-29 01:11:12
为了防止其他人遇到这个问题,我将babel-polyfill保留在了webpack的配置中,并将build命令更改为:
next build && babel .next/*.js --out-dir . --presets=es2015,react这是相当笨重的,因为一些代码被webpack巴别化,然后又在输出目录中。会喜欢其他的建议!
https://stackoverflow.com/questions/45358349
复制相似问题