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

feat: enable compression #903

Merged
merged 6 commits into from
Sep 27, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/waku/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { pathToFileURL } from 'node:url';
import { parseArgs } from 'node:util';
import { createRequire } from 'node:module';
import { Hono } from 'hono';
import { compress } from 'hono/compress'
import { contextStorage } from 'hono/context-storage';
import { serve } from '@hono/node-server';
import { serveStatic } from '@hono/node-server/serve-static';
Expand Down Expand Up @@ -144,6 +145,7 @@ async function runStart() {
import(pathToFileURL(path.resolve(distDir, DIST_ENTRIES_JS)).toString());
const app = new Hono();
app.use(contextStorage());
app.use(compress())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a good addition, it's not 100% certain if this won't cause any issues for all users.
So, my suggestion is to introduce a new option --experimental-compress and use it explicitly.
We can also enable it for the dev server too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

app.use('*', serveStatic({ root: path.join(distDir, DIST_PUBLIC) }));
app.use('*', runner({ cmd: 'start', loadEntries, env: process.env as any }));
app.notFound((c) => {
Expand Down