rollup cache saves 1s per js build

master
Hakim El Hattab 2020-05-19 19:04:46 +02:00
parent 84b52984cd
commit feb43ffdc9
1 changed files with 6 additions and 0 deletions

View File

@ -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',