Skip to content

Commit

Permalink
fix(vite): html transformation
Browse files Browse the repository at this point in the history
In some cases, such as adding a class to the `<head>` element in the `index.html`, would cause the Vite resource not being able to generate the `wing` environment object.

Also, stop opening the browser when Wing is running tests.
  • Loading branch information
skyrpex committed Feb 19, 2024
1 parent 0da7a60 commit dbb5b41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vite/vite-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions vite/vite.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -25,6 +26,7 @@ pub class Vite_sim {
cliFilename: cliFilename,
homeEnv: homeEnv,
pathEnv: pathEnv,
openBrowser: openBrowser,
});
state.set("url", url);
});
Expand Down

0 comments on commit dbb5b41

Please sign in to comment.