diff --git a/lib/index.js b/lib/index.js index 95fab4d..4f2dc3f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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 @@ -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 =