fix(web): use local node_modules/.bin/vite in dist-contract (#767)
Co-authored-by: Codex <codex@local>
This commit is contained in:
@@ -186,8 +186,13 @@ function listFiles(dir) {
|
||||
}
|
||||
|
||||
async function runViteBuild(rootDir, outDir) {
|
||||
const localVite = path.join(rootDir, "node_modules", ".bin", "vite");
|
||||
const command = fs.existsSync(localVite) ? localVite : "npx";
|
||||
const args = fs.existsSync(localVite)
|
||||
? ["build", "--outDir", outDir, "--emptyOutDir", "false"]
|
||||
: ["--yes", "vite@5.4.10", "build", "--outDir", outDir, "--emptyOutDir", "false"];
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn("bun", ["x", "vite", "build", "--outDir", outDir, "--emptyOutDir", "false"], { cwd: rootDir, stdio: ["ignore", "inherit", "inherit"] });
|
||||
const child = spawn(command, args, { cwd: rootDir, stdio: ["ignore", "inherit", "inherit"] });
|
||||
child.on("error", reject);
|
||||
child.on("exit", (code) => {
|
||||
if (code === 0) resolve();
|
||||
|
||||
Reference in New Issue
Block a user