Skip to content

Commit

Permalink
feat: enable rollup cache feature (#700)
Browse files Browse the repository at this point in the history
* Enable rollup cache feature

* Enable caching only in development

* Fix import path

* fix: linter errors
  • Loading branch information
nickschot authored and zacharygolba committed May 16, 2017
1 parent 73bb9d1 commit 10eaa23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/packages/compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { rollup } from 'rollup';

import { rmrf, readdir, readdirRec, isJSFile } from '../fs';
import template from '../template';
import { NODE_ENV } from '../../constants';

import onwarn from './utils/handle-warning';
import isExternal from './utils/is-external';
Expand All @@ -25,6 +26,8 @@ type CompileOptions = {
useStrict?: boolean;
};

let cache;

/**
* @private
*/
Expand Down Expand Up @@ -98,6 +101,7 @@ export async function compile(
entry,
onwarn,
external,
cache,
plugins: [
alias({
resolve: ['.js'],
Expand All @@ -122,6 +126,10 @@ export async function compile(
]
});

if (NODE_ENV === 'development') {
cache = bundle;
}

await rmrf(entry);

banner = template`
Expand Down

0 comments on commit 10eaa23

Please sign in to comment.