generated from egoist/ts-lib-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fork-releases' into main
- Loading branch information
Showing
10 changed files
with
121 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,11 +38,13 @@ export const plugin = (options: Options = {}): Plugin => { | |
// at /node_modules/.pnpm/[email protected]/node_modules/fetch-blob/streams.cjs:16:17 | ||
external: ["node-fetch", "@web-std/file"], | ||
// No sure why sometimes this is externalized | ||
noExternal: [/vite-vercel/], | ||
noExternal: [/vite-vercel/, /@cycraft\/vite-vercel/], | ||
}, | ||
resolve: { | ||
alias: { | ||
"vercel-utils": path.dirname(resolve("vercel-utils/polyfills")), | ||
"@cycraft/vercel-utils": path.dirname( | ||
resolve("@cycraft/vercel-utils/polyfills"), | ||
), | ||
}, | ||
}, | ||
} | ||
|
@@ -56,14 +58,16 @@ export const plugin = (options: Options = {}): Plugin => { | |
configureServer(server) { | ||
if (!middlewarePath || process.env.VITE_VERCEL_BUILD) return | ||
|
||
let serverNode: typeof import("vercel-utils/server-node") | undefined | ||
let serverNode: | ||
| typeof import("@cycraft/vercel-utils/server-node") | ||
| undefined | ||
|
||
server.middlewares.use(async (req, res, next) => { | ||
if (serverNode) return next() | ||
|
||
await server.ssrLoadModule("vercel-utils/polyfills") | ||
await server.ssrLoadModule("@cycraft/vercel-utils/polyfills") | ||
serverNode = (await server.ssrLoadModule( | ||
"vercel-utils/server-node", | ||
"@cycraft/vercel-utils/server-node", | ||
)) as any | ||
next() | ||
}) | ||
|
@@ -135,25 +139,24 @@ export const plugin = (options: Options = {}): Plugin => { | |
entrypoint: "index.js", | ||
}) | ||
} | ||
|
||
writeJson(".vercel/output/config.json", { | ||
version: 3, | ||
routes: [ | ||
{ | ||
src: `/assets/.+`, | ||
src: `/assets/(.+)`, | ||
headers: { | ||
"cache-control": "public, immutable, max-age=31536000", | ||
"Cache-Control": "public, immutable, max-age=31536000", | ||
}, | ||
}, | ||
{ | ||
handle: "filesystem", | ||
}, | ||
middlewarePath && { | ||
src: "/.*", | ||
src: "/(.*)", | ||
middlewarePath: "main", | ||
continue: true, | ||
}, | ||
{ src: "/.*", dest: "/index.html" }, | ||
{ src: "/(.*)", dest: "/index.html" }, | ||
].filter(Boolean), | ||
}) | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
import "vercel-utils/polyfills" | ||
import "@cycraft/vercel-utils/polyfills" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.