Skip to content

Commit

Permalink
Revert "use rollup watch when in watch mode"
Browse files Browse the repository at this point in the history
This reverts commit de386a6.
  • Loading branch information
gbaron authored and jlmakes committed Dec 13, 2022
1 parent 7922333 commit 8797035
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/index.js
Expand Up @@ -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)
Expand Down

0 comments on commit 8797035

Please sign in to comment.