fix(dev): support registering islands as file URLs (#3153)

This commit is contained in:
Marvin Hagemeister
2025-07-30 12:29:29 +02:00
committed by GitHub
parent d44dcdd60e
commit 1c9b096482
2 changed files with 42 additions and 6 deletions
+34
View File
@@ -155,6 +155,40 @@ Deno.test({
sanitizeResources: false,
});
Deno.test({
name: "Builder - can bundle islands with import.meta.resolve()",
fn: async () => {
await using _tmp = await withTmpDir();
const tmp = _tmp.dir;
const outDir = path.join(tmp, "dist");
const builder = new Builder({ outDir });
const specifier = import.meta.resolve(
"../../tests/fixtures_islands/Counter.tsx",
);
builder.registerIsland(specifier);
await builder.build({ mode: "production", snapshot: "disk" });
const name = specToName(specifier);
const code = await Deno.readTextFile(
path.join(
tmp,
"dist",
"static",
"_fresh",
"js",
BUILD_ID,
`${name}.js`,
),
);
expect(code).toContain('"decrement"');
},
sanitizeOps: false,
sanitizeResources: false,
});
Deno.test({
name: "Builder - exclude files",
fn: async () => {