diff --git a/lib/index.js b/lib/index.js index 42ddd60..ec8e396 100644 --- a/lib/index.js +++ b/lib/index.js @@ -67,20 +67,12 @@ function createPreprocessor(preconfig, config, emitter, logger) { options.output.dir = path.dirname(originalPath) } - let bundle; - options.cache = false; + let bundle = await rollup.rollup(options) + cache.set(originalPath, bundle.cache) if (watcher) { - const watch = await rollup.watch(options); - bundle = await new Promise(res => watch.on('event', ( { result, code }) => { - if (code === 'BUNDLE_END') return res(result); - })); - let [entry, ...dependencies] = bundle.watchFiles watcher.add(entry, dependencies) - } else { - bundle = await rollup.rollup(options) - cache.set(originalPath, bundle.cache) } log.info('Generating bundle for ./%s', location)