gpt4 book ai didi

javascript - 无法从 webpackAsyncContext 读取未定义的属性 'call'(Webpack 错误)

转载 作者:行者123 更新时间:2023-12-01 15:42:12 29 4
gpt4 key购买 nike

我的网站上的某些页面出现以下错误。它与Webpack有关。

TypeError: Cannot read property 'call' of undefined

为什么会发生此错误?

堆栈跟踪没有显示我的任何代码。它发生在 Webpack 代码中:
function webpackAsyncContext(e) {
if (!n.o(r, e))
return Promise.resolve().then((function() {
var t = new Error("Cannot find module '" + e + "'");
throw t.code = "MODULE_NOT_FOUND",
t
}
));
var t = r[e]
, o = t[0];
return Promise.all(t.slice(1).map(n.e)).then((function() {
return n(o) // <---- ERROR HAPPENING HERE
}
))
}

更新 1:

错误堆栈跟踪如下:
main-client.js?v=HBU…YpSTrLMew46Jy0:1644 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (main-client.js?v=HBU…HNYpSTrLMew46Jy0:20)
at main-client.js?v=HBU…pSTrLMew46Jy0:38946
at ZoneDelegate.invoke (main-client.js?v=HBU…pSTrLMew46Jy0:39643)
at Object.onInvoke (main-client.js?v=HBU…YpSTrLMew46Jy0:7197)
at ZoneDelegate.invoke (main-client.js?v=HBU…pSTrLMew46Jy0:39643)
at Zone.run (main-client.js?v=HBU…pSTrLMew46Jy0:39537)
at main-client.js?v=HBU…pSTrLMew46Jy0:40017
at ZoneDelegate.invokeTask (main-client.js?v=HBU…pSTrLMew46Jy0:39656)
at Object.onInvokeTask (main-client.js?v=HBU…YpSTrLMew46Jy0:7189)
at ZoneDelegate.invokeTask (main-client.js?v=HBU…pSTrLMew46Jy0:39656)
at resolvePromise (main-client.js?v=HBU…pSTrLMew46Jy0:39975)
at resolvePromise (main-client.js?v=HBU…pSTrLMew46Jy0:39952)
at main-client.js?v=HBU…pSTrLMew46Jy0:40018
at ZoneDelegate.invokeTask (main-client.js?v=HBU…pSTrLMew46Jy0:39656)
at Object.onInvokeTask (main-client.js?v=HBU…YpSTrLMew46Jy0:7189)
at ZoneDelegate.invokeTask (main-client.js?v=HBU…pSTrLMew46Jy0:39656)
at Zone.runTask (main-client.js?v=HBU…pSTrLMew46Jy0:39568)
at drainMicroTaskQueue (main-client.js?v=HBU…pSTrLMew46Jy0:39754)
defaultErrorLogger @ main-client.js?v=HBU…YpSTrLMew46Jy0:1644
ErrorHandler.handleError @ main-client.js?v=HBU…YpSTrLMew46Jy0:1663
next @ main-client.js?v=HBU…YpSTrLMew46Jy0:7472
i @ main-client.js?v=HBU…YpSTrLMew46Jy0:6748
SafeSubscriber.__tryOrUnsub @ main-client.js?v=HBU…pSTrLMew46Jy0:27250
SafeSubscriber.next @ main-client.js?v=HBU…pSTrLMew46Jy0:27224
Subscriber._next @ main-client.js?v=HBU…pSTrLMew46Jy0:27204
Subscriber.next @ main-client.js?v=HBU…pSTrLMew46Jy0:27196
Subject.next @ main-client.js?v=HBU…pSTrLMew46Jy0:36275
EventEmitter.emit @ main-client.js?v=HBU…YpSTrLMew46Jy0:6735
(anonymous) @ main-client.js?v=HBU…YpSTrLMew46Jy0:7207
ZoneDelegate.invoke @ main-client.js?v=HBU…pSTrLMew46Jy0:39643
Zone.run @ main-client.js?v=HBU…pSTrLMew46Jy0:39537
NgZone.runOutsideAngular @ main-client.js?v=HBU…YpSTrLMew46Jy0:7232
onHandleError @ main-client.js?v=HBU…YpSTrLMew46Jy0:7206
ZoneDelegate.handleError @ main-client.js?v=HBU…pSTrLMew46Jy0:39645
Zone.runGuarded @ main-client.js?v=HBU…pSTrLMew46Jy0:39550
_loop_1 @ main-client.js?v=HBU…pSTrLMew46Jy0:39890
Zone.__load_patch.n.microtaskDrainDone @ main-client.js?v=HBU…pSTrLMew46Jy0:39896
drainMicroTaskQueue @ main-client.js?v=HBU…pSTrLMew46Jy0:39760
Promise.then (async)
scheduleMicroTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39741
ZoneDelegate.scheduleTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39652
onScheduleTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39617
ZoneDelegate.scheduleTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39648
Zone.scheduleTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39586
Zone.scheduleMicroTask @ main-client.js?v=HBU…pSTrLMew46Jy0:39592
scheduleResolveOrReject @ main-client.js?v=HBU…pSTrLMew46Jy0:40011
resolvePromise @ main-client.js?v=HBU…pSTrLMew46Jy0:39971
(anonymous) @ main-client.js?v=HBU…pSTrLMew46Jy0:39928
webpackJsonpCallback @ main-client.js?v=HBU…YHNYpSTrLMew46Jy0:5
(anonymous) @ 0.js:formatted:1

更新 2:

从 Angular 7.2 升级到 9.1 后出现错误堆栈跟踪。还是同样的问题。
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:24)
at Module.280 (3.js:1)
at __webpack_require__ (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:24)
at main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:57250
at ZoneDelegate.invoke (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58417)
at Object.onInvoke (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:13800)
at ZoneDelegate.invoke (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58417)
at Zone.run (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58227)
at main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58839
at ZoneDelegate.invokeTask (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58440)
at resolvePromise (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58793)
at resolvePromise (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58761)
at main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58840
at ZoneDelegate.invokeTask (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58440)
at Object.onInvokeTask (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:13791)
at ZoneDelegate.invokeTask (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58440)
at Zone.runTask (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58267)
at drainMicroTaskQueue (main-client.js?v=En9ov5sOxlQIVwZOduy8ehlKv7mPkjk-C6t7aJXanQY:formatted:58572)

更新 3:

它与延迟加载有关。当我将其更改为默认加载(直接导入模块)时,它起作用了。 (我还更新了 href 并将其替换为 routerLink。)

现在,它具有默认加载。

最佳答案

我要写一个答案,因为它作为评论太长了。我怀疑这是因为服务人员。

我可以通过导航到食物链接或页面呈现一次后的另一个链接来重现您的问题。然后我有一个带有相同错误的空白页。

如果在导航到另一个页面之前我取消了服务 worker 的注册,则导航成功。

要测试和禁用 service worker,请打开 chrome 的调试器,转到 应用标签 ,然后点击服务人员 ,然后单击 注销在右侧。

您需要激活源映射以识别确切的错误,但我将其追踪到文件 3.js 的第 279 行(格式化后) .

ForumSubforumFormComponent
}()
, F = o(294) // <=== error here
, C = function() {
function Topic(t) {
this.contentItem = t,

注册 service worker 时,F 是一个函数
console.log(F)
ƒ hooks(){return a.apply(null,arguments)}

注册 service worker 时,o(294) 会抛出错误,可能是因为它没有包含在 webpack 中。

在网络选项卡中查看请求的文件时,似乎有 2 个不同版本的 main-client.js请求的文件(取决于浏览器或服务 worker 是否请求了页面)。

这可能是问题的原因。

此外,服务 worker 只能使用 HTTPS 注册,这可以解释为什么在使用 http 之前没有出现问题。无法再在您的网站上测试 http,因为存在 307 重定向到 https。

备注 如其中一条评论所示,您网站上的导航有点奇怪。每次导航时它都会刷新整个页面。此外, Angular 通用似乎并不总是呈现

关于javascript - 无法从 webpackAsyncContext 读取未定义的属性 'call'(Webpack 错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60678698/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com