Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deploy): deno #899

Merged
merged 14 commits into from
Sep 26, 2024
10 changes: 7 additions & 3 deletions packages/waku/src/lib/plugins/vite-plugin-deploy-deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ const getServeJsContent = (
distPublic: string,
srcEntriesFile: string,
) => `
import { Hono } from 'https://deno.land/x/hono/mod.ts';
import { serveStatic } from 'https://deno.land/x/hono/middleware.ts';
import { Hono } from 'jsr:@hono/hono';
import { serveStatic } from 'jsr:@hono/hono/deno';
import { contextStorage } from 'jsr:@hono/hono/context-storage';
import { runner } from 'waku/unstable_hono';

const distDir = '${distDir}';
Expand All @@ -21,7 +22,7 @@ const loadEntries = () => import('${srcEntriesFile}');
const env = Deno.env.toObject();

const app = new Hono();
// app.use(contextStorage()); // Hono v4.6 is not available on deno.land
app.use(contextStorage());
app.use('*', serveStatic({ root: distDir + '/' + publicDir }));
app.use('*', runner({ cmd: 'start', loadEntries, env }));
app.notFound(async (c) => {
Expand Down Expand Up @@ -76,6 +77,9 @@ export function deployDenoPlugin(opts: {
if (source === `${opts.srcDir}/${SERVE_JS}`) {
return source;
}
if (source.startsWith('jsr:@hono/hono')) {
return { id: source, external: true };
}
},
load(id) {
if (id === `${opts.srcDir}/${SERVE_JS}`) {
Expand Down
Loading