浏览代码

rollup cache saves 1s per js build

Hakim El Hattab 5 年之前
父节点
当前提交
feb43ffdc9
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      gulpfile.js

+ 6 - 0
gulpfile.js

@@ -73,13 +73,17 @@ const rollupConfigESM = {
     ]
     ]
 };
 };
 
 
+let rollupCache;
+
 // Creates a bundle with broad browser support, exposed
 // Creates a bundle with broad browser support, exposed
 // as UMD
 // as UMD
 gulp.task('js-es5', () => {
 gulp.task('js-es5', () => {
     return rollup({
     return rollup({
+        cache: rollupCache,
         input: 'js/index.js',
         input: 'js/index.js',
         ...rollupConfig
         ...rollupConfig
     }).then( bundle => {
     }).then( bundle => {
+        rollupCache = bundle.cache;
         return bundle.write({
         return bundle.write({
             name: 'Reveal',
             name: 'Reveal',
             file: './dist/reveal.js',
             file: './dist/reveal.js',
@@ -93,9 +97,11 @@ gulp.task('js-es5', () => {
 // Creates an ES module bundle
 // Creates an ES module bundle
 gulp.task('js-es6', () => {
 gulp.task('js-es6', () => {
     return rollup({
     return rollup({
+        cache: rollupCache,
         input: 'js/index.js',
         input: 'js/index.js',
         ...rollupConfigESM
         ...rollupConfigESM
     }).then( bundle => {
     }).then( bundle => {
+        rollupCache = bundle.cache;
         return bundle.write({
         return bundle.write({
             file: './dist/reveal.esm.js',
             file: './dist/reveal.esm.js',
             format: 'es',
             format: 'es',