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

2019-11-05 23:50:20 浏览数 (1)

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

修改wxappUnpacker中的wuWxss.js即可

代码语言:javascript复制
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]();
      }
  }
}

0 人点赞