分析webpackBootstrap笔记

经简化过后,最外层就是这个结构:

(function(a, b, c){
    console.log(a);  // print:1
    console.log(b);  // print:2
    console.log(c);  // print:3
})(1, 2, 3);

这是很常见的写法,不是很难。不过webpackBootstrap的写法太奇淫异技,而被懵逼了,没注意到圆括号。

(function(module){
    module[0];  // print:1
    module[1];  // print:2
    module[2];  // print:3
})([function(){console.log(1)}, function(){console.log(2)}, function(){console.log(3)}]);

下面传入参数是传入一个函数数组,就是特别要注意这一点。

评论

暂无评论