RollupJS模块打包工具提供了一系列可能的输出格式:
- AMD
- CommonJS
- ES模块
- IIFE
- UMD
- SystemJS
在特定情况下是否有一个经验法则可以选择哪种格式?
amd – Asynchronous Module Definition, used with module loaders like RequireJS
cjs – CommonJS, suitable for Node and Browserify/Webpack
es – Keep the bundle as an ES module file
iife – A self-executing function, suitable for inclusion as a <script> tag. (If you want to create a bundle for your application, you probably want to use this, because it leads to smaller file sizes.)
umd – Universal Module Definition, works as amd, cjs and iife all in one
system – Native format of the SystemJS