diff --git a/src/runtime/bake/dev_server/incremental_graph.rs b/src/runtime/bake/dev_server/incremental_graph.rs index 1841a8d7d5d8..14494e363a47 100644 --- a/src/runtime/bake/dev_server/incremental_graph.rs +++ b/src/runtime/bake/dev_server/incremental_graph.rs @@ -1320,9 +1320,8 @@ impl IncrementalGraph { if !found_existing { self.edge_lists.push(EdgeLists::default()); } - if self.stale_files.bit_length > idx { - self.stale_files.set(idx); - } + self.ensure_stale_bit_capacity(true)?; + self.stale_files.set(idx); match SIDE { Side::Client => { diff --git a/test/bake/dev/html.test.ts b/test/bake/dev/html.test.ts index 978cfedcc886..f76c1c330789 100644 --- a/test/bake/dev/html.test.ts +++ b/test/bake/dev/html.test.ts @@ -154,6 +154,41 @@ devTest("import then create", { await c.expectMessage("data"); }, }); +devTest("a file whose import failed to resolve is imported by a second file", { + files: { + "index.html": emptyHtmlFile({ + scripts: ["/entry.ts"], + }), + "entry.ts": ` + import "./broken"; + import "./first"; + `, + "broken.ts": ` + import "not-installed-pkg"; + export const value = "value"; + `, + // broken.ts has failed by the time the bundler gets to its second importer. + "first.ts": ` + import "./second"; + `, + "second.ts": ` + import "./third"; + `, + "third.ts": ` + import { value } from "./broken"; + console.log(value); + `, + }, + async test(dev) { + const c = await dev.client("/", { + errors: ['broken.ts:1:8: error: Could not resolve: "not-installed-pkg". Maybe you need to "bun install"?'], + }); + await c.expectReload(async () => { + await dev.write("broken.ts", `export const value = "value";`); + }); + await c.expectMessage("value"); + }, +}); devTest("external links", { files: { "index.html": `