diff --git a/vite/package.json b/vite/package.json index 353e9aa6..47285cd5 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/vite", - "version": "0.0.2", + "version": "0.0.3", "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", diff --git a/vite/vite-cli.mjs b/vite/vite-cli.mjs index ee1c5b89..c68cc7cf 100644 --- a/vite/vite-cli.mjs +++ b/vite/vite-cli.mjs @@ -37,7 +37,9 @@ if (command === "dev") { }) ); - server.openBrowser(); + if (options.openBrowser) { + server.openBrowser(); + } } else if (command === "build") { const resolvedConfig = await resolveConfig(config); console.log( diff --git a/vite/vite-plugin.mjs b/vite/vite-plugin.mjs index f7fd02d3..2a8e0d29 100644 --- a/vite/vite-plugin.mjs +++ b/vite/vite-plugin.mjs @@ -20,12 +20,12 @@ export const plugin = (options) => { }, transformIndexHtml(html) { return html.replace( - "", - `\n ` + )})});\n` ); }, async buildStart() { diff --git a/vite/vite.sim.w b/vite/vite.sim.w index b8bd94bb..83a5e0f1 100644 --- a/vite/vite.sim.w +++ b/vite/vite.sim.w @@ -14,6 +14,7 @@ pub class Vite_sim { let cliFilename = Vite_sim.cliFilename(); let homeEnv = util.env("HOME"); let pathEnv = util.env("PATH"); + let openBrowser = util.env("WING_IS_TEST") != "true"; new cloud.Service(inflight () => { let url = Vite_sim.dev({ @@ -25,6 +26,7 @@ pub class Vite_sim { cliFilename: cliFilename, homeEnv: homeEnv, pathEnv: pathEnv, + openBrowser: openBrowser, }); state.set("url", url); });