diff --git a/.changeset/stale-carpets-repair.md b/.changeset/stale-carpets-repair.md new file mode 100644 index 00000000..8ca319e9 --- /dev/null +++ b/.changeset/stale-carpets-repair.md @@ -0,0 +1,5 @@ +--- +"vinxi": patch +--- + +externalize h3 from vite builds so its only included once in the final server build diff --git a/packages/vinxi/lib/build.js b/packages/vinxi/lib/build.js index e1bb2e10..4c67dda9 100644 --- a/packages/vinxi/lib/build.js +++ b/packages/vinxi/lib/build.js @@ -294,6 +294,7 @@ async function createRouterBuild(app, router) { ssrManifest: true, rollupOptions: { input: { handler: router.handler }, + external: ["h3"], }, target: "esnext", outDir: join(router.build.outDir + "_entry"), @@ -399,6 +400,11 @@ const routerModePlugin = { ssr: { noExternal: ["vinxi"], }, + build: { + rollupOptions: { + external: ["h3"], + }, + }, optimizeDeps: { force: true, exclude: ["vinxi"], @@ -414,6 +420,11 @@ const routerModePlugin = { ssr: { noExternal: ["vinxi"], }, + build: { + rollupOptions: { + external: ["h3"], + }, + }, optimizeDeps: { disabled: true, }, @@ -429,6 +440,11 @@ const routerModePlugin = { ssr: { noExternal: ["vinxi"], }, + build: { + rollupOptions: { + external: ["h3"], + }, + }, optimizeDeps: { force: true, exclude: ["vinxi"], diff --git a/packages/vinxi/vinxi.d.ts b/packages/vinxi/vinxi.d.ts index 03a0d0cd..70aeefa3 100644 --- a/packages/vinxi/vinxi.d.ts +++ b/packages/vinxi/vinxi.d.ts @@ -208,12 +208,12 @@ export type RouterMode = { type CreateApp = < T extends BundlerConfig, R extends RouterConfig = RouterConfig, ->(config: { +>(config?: { bundlers?: T[]; routers: R[]; }) => App; -export { createApp } from "./lib/app"; +export const createApp: CreateApp; export type { ViteDevServer as DevServer } from "vite";