Skip to content

Commit

Permalink
fix(web): Correctly set vite config path and root path for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
munshkr committed Jan 13, 2024
1 parent a63597a commit 55179f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 12 additions & 1 deletion packages/web/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { networkInterfaces } from "os";
import pc from "picocolors";
import process from "process";
import ViteExpress from "./vite-express.js";
import { fileURLToPath } from "url";
import path from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

function info(msg) {
const timestamp = new Date().toLocaleString("en-US").split(",")[1].trim();
Expand Down Expand Up @@ -39,7 +44,13 @@ export async function startServer({ onReady, staticDir, ...opts }) {
viteServer = http.createServer(app);
}

ViteExpress.config({ vitePort: opts.port });
ViteExpress.config({
inlineViteConfig: {
root: path.resolve(__dirname),
},
viteConfigFile: path.resolve(__dirname, "vite.config.ts"),
vitePort: opts.port,
});
ViteExpress.bind(app, viteServer);

const server = withFlokServer(viteServer);
Expand Down
4 changes: 0 additions & 4 deletions packages/web/vite-express.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import express from "express";
import fs from "fs";
import path from "path";
import pc from "picocolors";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

let Vite;
try {
Expand Down

0 comments on commit 55179f5

Please sign in to comment.