diff --git a/src/index.ts b/src/index.ts index 951ee50..42906d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import pluginUtils from '@rollup/pluginutils'; import fs from 'fs'; +import { resolve as resolvePath } from 'path'; import { ExistingRawSourceMap, Plugin, PluginContext } from 'rollup'; import { promisify } from 'util'; import { resolveSourceMap, resolveSources } from './source-map-resolve'; @@ -27,6 +28,9 @@ export default function sourcemaps( return null; } + // Allow the original file to be watched + this.addWatchFile(resolvePath(id)); + try { // Try to read the file with the given id code = (await promisifiedReadFile(id)).toString();