aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/module_loader.zig19
-rw-r--r--src/watcher.zig1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig
index 0e4cb5ba2..4763ed1bc 100644
--- a/src/bun.js/module_loader.zig
+++ b/src/bun.js/module_loader.zig
@@ -450,6 +450,25 @@ pub const RuntimeTranspilerStore = struct {
return;
};
+ if (vm.isWatcherEnabled()) {
+ if (input_file_fd != 0) {
+ if (vm.bun_watcher != null and !is_node_override and
+ std.fs.path.isAbsolute(path.text) and !strings.contains(path.text, "node_modules"))
+ {
+ should_close_input_file_fd = false;
+ vm.bun_watcher.?.addFile(
+ input_file_fd,
+ path.text,
+ hash,
+ loader,
+ 0,
+ package_json,
+ true,
+ ) catch {};
+ }
+ }
+ }
+
for (parse_result.ast.import_records.slice()) |*import_record_| {
var import_record: *bun.ImportRecord = import_record_;
diff --git a/src/watcher.zig b/src/watcher.zig
index 9bc61b3af..a31267c5f 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -693,6 +693,7 @@ pub fn NewWatcher(comptime ContextType: type) type {
package_json: ?*PackageJSON,
comptime copy_file_path: bool,
) !void {
+ // This must lock due to concurrent transpiler
this.mutex.lock();
defer this.mutex.unlock();