feat(vite): check valid imports per environment (#3299)

Fixes https://github.com/denoland/fresh/issues/3296
This commit is contained in:
Marvin Hagemeister
2025-09-01 17:30:30 +02:00
committed by GitHub
parent 5d052c0fdb
commit ff9db336f7
11 changed files with 291 additions and 35 deletions
+13
View File
@@ -375,3 +375,16 @@ Deno.test({
sanitizeOps: false,
sanitizeResources: false,
});
Deno.test({
name: "vite build - error on 'node:process' import",
fn: async () => {
const fixture = path.join(FIXTURE_DIR, "node_builtin");
await expect(buildVite(fixture)).rejects.toThrow(
"Node built-in modules cannot be imported in the browser",
);
},
sanitizeOps: false,
sanitizeResources: false,
});