JavaScript 模块绑定工具:rollup.js

jopen 8年前

rollup.js 是下一代的 JavaScript 模块绑定工具,使用 ES2015 模块编写你的应用或者库,可以高校的绑定他们成为单个文件,在浏览器或者 Node.js 中使用,甚至是一些高级特性的绑定,比如 bindings 和 cycles。

rollup.js 类似 Browserify,生产包比 Browserify 小,或者是跟 Webpack 等价,因为 ES2015 模块比 CommonJS 模块高效。

代码示例:

AMD:

define(function () { 'use strict';      // This function gets included      function cube ( x ) {          // rewrite this as `square( x ) * x`          // and see what happens!          return x * x * x;      }      console.log( cube( 5 ) ); // 125  });

ES2015:

// This function gets included  function cube ( x ) {      // rewrite this as `square( x ) * x`      // and see what happens!      return x * x * x;  }  console.log( cube( 5 ) ); // 125

项目主页:http://www.open-open.com/lib/view/home/1445391616913