diff --git a/packages/vinxi/lib/app.js b/packages/vinxi/lib/app.js index 8dbc28e7..92d8cecc 100644 --- a/packages/vinxi/lib/app.js +++ b/packages/vinxi/lib/app.js @@ -12,9 +12,7 @@ import { resolveRouterConfig, routerSchema } from "./router-modes.js"; routers?: import("./router-modes.js").RouterSchemaInput[]; name?: string; - server?: import('nitropack').NitroConfig & { - baseURL?: string; - }; + server?: Omit; root?: string }} AppOptions */ @@ -22,7 +20,7 @@ import { resolveRouterConfig, routerSchema } from "./router-modes.js"; config: { name: string; devtools: boolean; - server: import("nitropack").NitroConfig; + server: Omit; routers: import("./router-mode.js").Router[]; root: string; }; diff --git a/packages/vinxi/lib/build.js b/packages/vinxi/lib/build.js index 1a7cdb78..c2722c4a 100644 --- a/packages/vinxi/lib/build.js +++ b/packages/vinxi/lib/build.js @@ -83,6 +83,7 @@ export async function createBuild(app, buildConfig) { "node-fetch-native/polyfill": require.resolve( "node-fetch-native/polyfill", ), + ...(app.config.server.alias ?? {}), // "unstorage/drivers/fs-lite": require.resolve("unstorage/drivers/fs-lite"), // "unstorage/drivers/fs": require.resolve("unstorage/drivers/fs"), // defu: require.resolve("defu"), diff --git a/packages/vinxi/lib/plugins/config.js b/packages/vinxi/lib/plugins/config.js index b9cc8935..93e6af2c 100644 --- a/packages/vinxi/lib/plugins/config.js +++ b/packages/vinxi/lib/plugins/config.js @@ -1,7 +1,7 @@ /** * * @param {string} tag - * @param {Omit} conf + * @param {import('../vite-dev.d.ts').CustomizableConfig} conf * @returns {import('../vite-dev.d.ts').Plugin} */ export function config(tag, conf) { diff --git a/packages/vinxi/lib/vite-dev.d.ts b/packages/vinxi/lib/vite-dev.d.ts index 97097684..a27f1bca 100644 --- a/packages/vinxi/lib/vite-dev.d.ts +++ b/packages/vinxi/lib/vite-dev.d.ts @@ -1,8 +1,8 @@ import { Plugin as VitePlugin, ResolvedConfig as _ResolvedConfig } from "vite"; import { App } from "./app.js"; -import { Router } from "./router-mode.js"; import { DevConfig } from "./dev-server.js"; +import { Router } from "./router-mode.js"; declare module "vite" { interface UserConfig { @@ -28,4 +28,27 @@ export type ViteConfig = _ResolvedConfig & { router: Router; app: App }; export type Plugin = VitePlugin; +export type CustomizableConfig = Omit< + import("vite").InlineConfig, + | "appType" + | "app" + | "router" + | "base" + | "root" + | "publicDir" + | "mode" + | "server" + | "preview" + | "clearScreen" + | "configFile" + | "envFile" +> & { + build?: Omit< + import("vite").InlineConfig["build"], + "outDir" | "ssr" | "ssrManifest" | "rollupOptions" + > & { + rollupOptions?: Omit; + }; +}; + export type { ConfigEnv as ConfigEnv } from "vite";