Skip to content

Commit

Permalink
Support watching for source changes
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Aug 5, 2024
1 parent f35e1ba commit 8642b54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 8642b54

Please sign in to comment.