Closure Compiler可以构建CommonJS模块

the*_*dow 6 javascript build-process google-closure-compiler commonjs

我想使用Google Closure Compiler构建一组CommonJS模块.这可以开箱即用吗?或者,是否可以对CommonJS模块进行一些简单的转换,以允许Closure Compiler使用它们?

Chr*_*ert 6

Closure Compiler增加了支持,使用以下编译器标志更容易使用Common JSAMD/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模块的实验支持