李恒道 发表于 2023-11-18 22:03:17

webpack push函数hook

```js
let originObecjt = undefined;
Object.defineProperty(unsafeWindow, "name", {
    get() {

      return originObecjt;
    },
    set(newValue) {
      originObecjt = newValue;
      const originPush = originObecjt.push;
      originObecjt.push = function (...args) {
            if (args === 512) {
                const originSwitchFunc = args
                args = function (e, t, n) {
                  //t是导出内容
                  const result = originSwitchFunc.call(this, e, t, n)
                  return result
                }
            }
            return originPush.call(this, ...args);
      };
    },
});
```

王一之 发表于 2023-11-19 02:06:24

看看我的勋章

unity韩 发表于 2023-11-19 09:55:48

ggnb,+3灌水
页: [1]
查看完整版本: webpack push函数hook