Skip to content

Commit

Permalink
fix(vite): vite resource doesn't work in windows (#133)
Browse files Browse the repository at this point in the history
fixing path prefixed with a '/'
also stop using non exiting env vars on windows
  • Loading branch information
ainvoner authored Mar 19, 2024
1 parent c0eff41 commit 568595a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/vite",
"version": "0.1.2",
"version": "0.1.3",
"description": "Wing resource that allows deploying a Vite application to the cloud",
"repository": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion vite/vite-plugin.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { mkdir, writeFile } from "node:fs/promises";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

const PLUGIN_NAME = "@winglibs/vite";

Expand Down Expand Up @@ -74,7 +75,8 @@ export const plugin = (options) => {
);

const dtsFilename = new URL(options.typeDefinitionsFilename, root);
await mkdir(dirname(dtsFilename.pathname), { recursive: true });
let path = dirname(fileURLToPath(dtsFilename));
await mkdir(path, { recursive: true });
await writeFile(dtsFilename, dts.join("\n"));
},
};
Expand Down
4 changes: 2 additions & 2 deletions vite/vite.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub class Vite_sim {
this.url = state.token("url");

let cliFilename = Vite_sim.cliFilename();
let homeEnv = util.env("HOME");
let pathEnv = util.env("PATH");
let homeEnv = util.tryEnv("HOME") ?? "";
let pathEnv = util.tryEnv("PATH") ?? "";
let openBrowser = util.env("WING_IS_TEST") != "true";

new cloud.Service(inflight () => {
Expand Down

0 comments on commit 568595a

Please sign in to comment.