Skip to content

Commit b778444

Browse files
author
echoVic
committed
fix: correct web dist path detection in server
- Remove fallback to source web directory (web/) - Only serve from built dist/web/ directory - Check for /assets/ in index.html to ensure it's the built version
1 parent 1c820dd commit b778444

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/cli/src/server/server.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@ function getWebDistPath(): string | null {
4040
const currentDir = dirname(fileURLToPath(import.meta.url));
4141

4242
const possiblePaths = [
43-
join(currentDir, '..', 'web'),
4443
join(currentDir, 'web'),
4544
join(process.cwd(), 'dist/web'),
4645
join(process.cwd(), 'packages/cli/dist/web'),
4746
];
4847

4948
for (const p of possiblePaths) {
50-
if (existsSync(join(p, 'index.html'))) {
51-
logger.debug(`[Server] Found web dist at: ${p}`);
52-
return p;
49+
const indexPath = join(p, 'index.html');
50+
if (existsSync(indexPath)) {
51+
const content = readFileSync(indexPath, 'utf-8');
52+
if (content.includes('/assets/')) {
53+
logger.debug(`[Server] Found web dist at: ${p}`);
54+
return p;
55+
}
5356
}
5457
}
5558

0 commit comments

Comments
 (0)