webpack tapable为什么要用new Function动态生成代码

如题:

case "sync":
                fn = new Function(                    this.args(),                    '"use strict";\n' +                        this.header() +                        this.content({
                            onError: err => `throw ${err};\n`,
                            onResult: result => `return ${result};\n`,
                            onDone: () => "",
                            rethrowIfPossible: true
                        })
                );                break;


慕田峪9158850
浏览 818回答 1
1回答

撒科打诨

因为这边需要返回一个函数,以备后续调用
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python