Files
tulin-code/webpack-2026-09-04/3. webpack逆向时会遇到的问题.js
Whale-Fall-Code 418a0411d1 Initialize encryption and JavaScript reverse-engineering study repository
Document the project structure and setup while excluding local dependencies and IDE settings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09 23:25:05 +08:00

55 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 模块有上千个
* 模块分布在不同的文件
* */
// 1. 如何在自执行webpack函数外部调用模块
// 2. 加载器初始化问题(浏览器环境检测问题)
// 3. 模块丢失问题
window = global
!(function (func_object) {
function inner_func(key) {
// 打印模块调用日志
console.log("被调用的模块是:", key);
func_object[key].call();
}
// 调用模块加载器
// inner_func("encrypt")
//将内部加载器挂在到全局
window.loader = inner_func;
// inner_func("web_env"); 如果在内部加载器中调用了环境检测直接注释
})({
"encrypt": function () {
console.log("加密...");
},
"decrypt": function () {
console.log("解密...");
},
"web_env": function () {
console.log("浏览器环境检测...");
},
})
// 问题1:将内部加载器挂载到顶级对象上
/*
window.loader("encrypt")
window.loader("decrypt")
*/
// 问题2:对于加载器初始化出现环境问题,直接注释
// inner_func("web_env")
// 问题3:模块丢失(在真实的网站模块调用当中可能存在模块是动态加载过来的)
// 解决方式就是模块定位(在内部加载器中打执行日志)
window.loader("339b")