反编译微信小程序错误解决

2019-10-08 20:13:46

$gwx is not defined和__vd_version_info__ is not defined错误解决

修改wxappUnpacker中的wuWxss.js即可


function runVM(name, code) {
  // let wxAppCode = {}, handle = {cssFile: name};
  // let vm = new VM({
  //    sandbox: Object.assign(new GwxCfg(), {
  //       __wxAppCode__: wxAppCode,
  //       setCssToHead: cssRebuild.bind(handle)
  //    })
  // });
  // vm.run(code);
  // for (let name in wxAppCode) if (name.endsWith(".wxss")) {
  //    handle.cssFile = path.resolve(frameName, "..", name);
  //    wxAppCode[name]();
  // }

  let wxAppCode = {};
  let handle = {cssFile: name};
  let gg = new GwxCfg();
  let tsandbox = {
      $gwx: GwxCfg.prototype["$gwx"],
      __mainPageFrameReady__: GwxCfg.prototype["$gwx"],   //解决 $gwx is not defined
      __vd_version_info__: GwxCfg.prototype["$gwx"],  //解决 __vd_version_info__ is not defined
      __wxAppCode__: wxAppCode,
      setCssToHead: cssRebuild.bind(handle)
  }

  let vm = new VM({sandbox: tsandbox});
  vm.run(code);
  for (let name in wxAppCode) {
      if (name.endsWith(".wxss")) {
        handle.cssFile = path.resolve(frameName, "..", name);
        wxAppCode[name]();
      }
  }
}
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-ND 3.0 许可协议。可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。

扫描下方二维码阅读当前文章

浏览器、微信扫码

评 论:

好文推荐
每天进步一点点~