如果出现 Cannot find module 'xxx' 表示模块未安装 运行命令 npm install 'xxx' , 安装依赖 如果遇到 __vd_version_info__ is not defined这种报错 解决方法如下:
修改反编译脚本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](); } }
改为
function runVM(name,code){ let wxAppCode={},handle={cssFile:name}; let gg = new GwxCfg(); let tsandbox ={$gwx:GwxCfg.prototype["$gwx"],__mainPageFrameReady__:GwxCfg.prototype["$gwx"],__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](); } }