Skip to content

Commit

Permalink
docs(changeset): externalize h3 from vite builds so its only included…
Browse files Browse the repository at this point in the history
… once in the final server build
  • Loading branch information
nksaraf committed Sep 13, 2023
1 parent b934e84 commit 085116d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-carpets-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vinxi": patch
---

externalize h3 from vite builds so its only included once in the final server build
16 changes: 16 additions & 0 deletions packages/vinxi/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -399,6 +400,11 @@ const routerModePlugin = {
ssr: {
noExternal: ["vinxi"],
},
build: {
rollupOptions: {
external: ["h3"],
},
},
optimizeDeps: {
force: true,
exclude: ["vinxi"],
Expand All @@ -414,6 +420,11 @@ const routerModePlugin = {
ssr: {
noExternal: ["vinxi"],
},
build: {
rollupOptions: {
external: ["h3"],
},
},
optimizeDeps: {
disabled: true,
},
Expand All @@ -429,6 +440,11 @@ const routerModePlugin = {
ssr: {
noExternal: ["vinxi"],
},
build: {
rollupOptions: {
external: ["h3"],
},
},
optimizeDeps: {
force: true,
exclude: ["vinxi"],
Expand Down
4 changes: 2 additions & 2 deletions packages/vinxi/vinxi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ export type RouterMode<T extends RouterConfig["mode"]> = {
type CreateApp = <
T extends BundlerConfig,
R extends RouterConfig<T> = RouterConfig<T>,
>(config: {
>(config?: {
bundlers?: T[];
routers: R[];
}) => App<T, R>;

export { createApp } from "./lib/app";
export const createApp: CreateApp;

export type { ViteDevServer as DevServer } from "vite";

Expand Down

0 comments on commit 085116d

Please sign in to comment.