小编Rap*_*ara的帖子

如何更新每个块的模块源代码?

最近,我开始学习如何构建webpack插件.我正在尝试构建一个可以更新源代码的插件.

规则很简单:

  1. 如果入口点名称有小于2个aS,我要所有的变量命名haha,以hehe在上述的大块所有模块的入口点.
  2. 如果入口点名称已超过2个aS,我要所有的变量命名hahahoho所有模块中说的块入口点.

这是我的代码:

a.js

const haha = 'hello';
// will be "const hehe = 'hello';" in the bundle of "aa" entry point
// will be "const hoho = 'hello';" in the bundle of "aaaa" entry point
console.log(haha);
// will be "console.log(hehe);" in the bundle of "aa" entry point
// will be "console.log(hoho);" in the bundle of "aaaa" entry …
Run Code Online (Sandbox Code Playgroud)

parsing abstract-syntax-tree webpack webpack-plugin

9
推荐指数
1
解决办法
112
查看次数

两个对象的Javascript联合

我有一个对象:

Object { name: " ", email: " " }
Run Code Online (Sandbox Code Playgroud)

另一个:

Object { name: Array[x], email: Array[y]}
Run Code Online (Sandbox Code Playgroud)

我希望工会像:

Object { name: {" ", Array[x]}, email: {" ", Array[y]} }
Run Code Online (Sandbox Code Playgroud)

javascript union properties object

5
推荐指数
1
解决办法
4087
查看次数