Skip to content

Commit

Permalink
Fix watch not processing original files
Browse files Browse the repository at this point in the history
  • Loading branch information
Druska committed Aug 12, 2019
1 parent 9332a90 commit ffdfae8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ function createPreprocessor(preconfig, config, emitter, logger) {
}

return async function preprocess(original, file, done) {
const location = path.relative(config.basePath, file.path)
const originalPath = file.originalPath
const location = path.relative(config.basePath, originalPath)
try {
const options = Object.assign({}, config.rollupPreprocessor, preconfig.options, {
input: file.path,
cache: cache.get(file.path),
input: originalPath,
cache: cache.get(originalPath),
})

const bundle = await rollup.rollup(options)
cache.set(file.path, bundle.cache)
cache.set(originalPath, bundle.cache)

if (watcher) {
const [entry, ...dependencies] = bundle.watchFiles
Expand All @@ -43,7 +44,7 @@ function createPreprocessor(preconfig, config, emitter, logger) {
* for processors that have alternate source file extensions,
* make sure to use the output rollup file name
*/
const parsedPath = path.parse(file.path)
const parsedPath = path.parse(originalPath)
file.path = `${parsedPath.dir}/${result.fileName}`

const processed =
Expand Down

0 comments on commit ffdfae8

Please sign in to comment.