From 085116d9fab2fd9599a927c72be75d7fa3f6a317 Mon Sep 17 00:00:00 2001 From: Nikhil Saraf Date: Thu, 14 Sep 2023 01:42:47 +0530 Subject: [PATCH] docs(changeset): externalize h3 from vite builds so its only included once in the final server build --- .changeset/stale-carpets-repair.md | 5 +++++ packages/vinxi/lib/build.js | 16 ++++++++++++++++ packages/vinxi/vinxi.d.ts | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .changeset/stale-carpets-repair.md 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";