-
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.
- Loading branch information
Showing
17 changed files
with
538 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/node_modules/ | ||
/dist/ | ||
.vercel | ||
.wrangler |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const config = { | ||
runtime: 'edge' | ||
} | ||
|
||
// Import the built server entry from dist, so import.meta.env and other Vite features | ||
// are available in server/app.js (Vite already processed this file) | ||
import app from '../dist/server/app.mjs' | ||
|
||
export const GET = app.fetch | ||
export const POST = app.fetch |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Hono } from 'hono' | ||
import vike from 'vike-node/hono' | ||
|
||
const app = new Hono() | ||
app.use(vike()) | ||
export default app |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { serve } from '@hono/node-server' | ||
import app from './app.js' | ||
|
||
startServer() | ||
|
||
function startServer() { | ||
const port = process.env.PORT || 3000 | ||
serve( | ||
{ | ||
fetch: app.fetch, | ||
port: +port, | ||
// Needed for Bun | ||
overrideGlobalObjects: false | ||
}, | ||
() => console.log(`Server running at http://localhost:${port}`) | ||
) | ||
} |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"rewrites": [ | ||
{ | ||
"source": "/((?!assets/).*)", | ||
"destination": "/api" | ||
"destination": "/api/edge-ssr" | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import react from '@vitejs/plugin-react' | ||
import esbuild from 'esbuild' | ||
import { builtinModules } from 'module' | ||
import vikeNode from 'vike-node/plugin' | ||
import vike from 'vike/plugin' | ||
import { UserConfig } from 'vite' | ||
|
||
export default { | ||
plugins: [ | ||
react(), | ||
vike({ prerender: true }), | ||
vikeNode({ entry: { index: 'server/node-entry.js', app: 'server/app.js' } }), | ||
|
||
// TODO: move this into library | ||
{ | ||
apply(_, env) { | ||
return env.isSsrBuild && process.env.VERCEL | ||
}, | ||
closeBundle() { | ||
esbuild.buildSync({ | ||
entryPoints: ['dist/server/app.mjs'], | ||
outfile: 'dist/server/app.mjs', | ||
format: 'esm', | ||
external: [...builtinModules, ...builtinModules.map((m) => `node:${m}`)], | ||
bundle: true, | ||
target: 'es2022', | ||
logLevel: 'info', | ||
logOverride: { | ||
'ignored-bare-import': 'verbose', | ||
'require-resolve-not-external': 'verbose' | ||
}, | ||
minify: false, | ||
allowOverwrite: true, | ||
define: { | ||
'process.env.NODE_ENV': '"production"', | ||
'import.meta.env.NODE_ENV': '"production"' | ||
}, | ||
conditions: ['edge-light', 'worker', 'browser', 'module', 'import', 'require'] | ||
}) | ||
} | ||
} | ||
] | ||
} as UserConfig |
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
Oops, something went wrong.