闭包编译器可以构建CommonJS模块

Can Closure Compiler build CommonJS modules

本文关键字:CommonJS 模块 构建 编译器 闭包      更新时间:2023-09-26

我想使用Google闭包编译器来构建一组CommonJS模块。这可以开箱即用吗?或者,是否可以对CommonJS模块进行一些简单的转换,以允许闭包编译器使用它们?

Closure Compiler增加了支持,使用以下编译器标志可以更容易地使用Common JS和AMD/require.JS模块:

  • --transform_amd_modules
  • --process_common_js_modules
  • --common_js_entry_module
  • --common_js_module_path_prefix

请参阅Closure Compiler 中对Common JS和AMD/require.JS模块的实验支持