anti报错解决

0 阅读1分钟

错误1 `anti_content_slim.js:1677

, u = Object.keys(c).reduce((function(e, t) {

TypeError: Cannot convert undefined or null to object`

新建一个

if (typeof window !== "undefined") { window.__REGION_CONFIG__ = window.__REGION_CONFIG__ || {}; } 即可

错误2:

temu_anti:202 Uncaught TypeError: Failed to set the 'src' property on 'HTMLScriptElement': This document requires 'TrustedScriptURL' assignment. at i.oldL (anti_content_slim:202:23)

i.oldL 和 i.l 是 webpack 的动态脚本加载器,用于按需从 CDN 加载其他 chunk 的 JS 文件。它内部用 document.createElement("script") 创建 script 标签并设置 src,这在启用了 Trusted Types CSP 策略的页面上会被拦截。精简版文件里所有需要的模块已经全部内联了,根本不需要动态加载外部脚本,所以直接把这两个函数替换成空函数即可。

i.oldL = function() {};  i.l = function() {};

错误3:

VM65 temu_anti:6450 Uncaught (in promise) TypeError: (0 , f.requestLogger) is not a function at p (VM65 temu_anti:6450:29)

image.png

发现是个发包请求,不发包,注释