修改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]();
}
}
}
from:https://blog.csdn.net/weixin_34342992/article/details/91383119
|
请发表评论