Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/static/src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import type { Plugin } from "vite";
import { normalizePath, type Plugin } from "vite";
import rsc from "@vitejs/plugin-rsc";
import { buildApp } from "../build/buildApp";
import { serverPlugin } from "./server";
Expand Down Expand Up @@ -129,20 +129,28 @@ export default function funstackStatic(
name: "@funstack/static:config",
configResolved(config) {
if (isMultiEntry) {
resolvedEntriesModule = path.resolve(config.root, options.entries);
resolvedEntriesModule = normalizePath(
path.resolve(config.root, options.entries),
);
} else {
// For single-entry, we store both resolved paths to generate a
// synthetic entries module in the virtual module loader.
const resolvedRoot = path.resolve(config.root, options.root);
const resolvedApp = path.resolve(config.root, options.app);
const resolvedRoot = normalizePath(
path.resolve(config.root, options.root),
);
const resolvedApp = normalizePath(
path.resolve(config.root, options.app),
);
// Encode as JSON for safe embedding in generated code
resolvedEntriesModule = JSON.stringify({
root: resolvedRoot,
app: resolvedApp,
});
}
if (clientInit) {
resolvedClientInitEntry = path.resolve(config.root, clientInit);
resolvedClientInitEntry = normalizePath(
path.resolve(config.root, clientInit),
);
}
},
configEnvironment(_name, config) {
Expand Down