fix(vite): error when npm package requires json files (#3210)

This commit is contained in:
Marvin Hagemeister
2025-08-08 14:16:38 +02:00
committed by GitHub
parent 1f3f0a48f5
commit d026375c3e
7 changed files with 81 additions and 3 deletions
+25
View File
@@ -142,3 +142,28 @@ Deno.test({
sanitizeOps: false,
sanitizeResources: false,
});
Deno.test({
name: "vite build - load json inside npm package",
fn: async () => {
await using res = await buildVite(DEMO_DIR);
await withChildProcessServer(
{
cwd: res.tmp,
args: ["serve", "-A", "--port", "0", "_fresh/server.js"],
},
async (address) => {
await withBrowser(async (page) => {
await page.goto(`${address}/tests/mime`, {
waitUntil: "networkidle2",
});
await page.locator(".ready").wait();
});
},
);
},
sanitizeOps: false,
sanitizeResources: false,
});
@@ -128,3 +128,19 @@ Deno.test({
sanitizeResources: false,
sanitizeOps: false,
});
Deno.test({
name: "vite dev - can import json in npm package",
fn: async () => {
await withDevServer(DEMO_DIR, async (address) => {
await withBrowser(async (page) => {
await page.goto(`${address}/tests/mime`, {
waitUntil: "networkidle2",
});
await page.locator(".ready").wait();
});
});
},
sanitizeResources: false,
sanitizeOps: false,
});