JavaScript 模塊綁定工具:rollup.js

jopen 9年前發布 | 9K 次閱讀 rollup.js JavaScript開發

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.baiduhome.net/lib/view/home/1445391616913

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!