Hwy is a fullstack web framework for driving a (p)react frontend with a Go backend. Includes end-to-end typesafety, file-based nested UI routing, and much more.
Also, this won't work with Wrangler / Cloudflare Pages, because in that case Wrangler controls your dev server and browser reloading logic.
Adds new route loading strategy choices
Now you can set hwyConfig.routeStrategy to bundle, warm-cache-at-startup, always-lazy, or lazy-once-then-cache. If nothing is explicitly set, the default will be always-lazy.
bundle: All your routes will be bundled into your server entry and always in memory.
warm-cache-at-startup: Your routes will be kept in separate modules, but on the first load of your server entry file, they'll all be eagerly imported and added to in-memory cache.
always-lazy: This is the standard behavior. Your routes will be kept in separate modules and imported dynamically when needed. They will not be explicitly added to any in-memory cache. Any caching would be handled however the applicable runtime handles module caching "under the hood".
lazy-once-then-cache: Like warm, but the modules won't be cached eagerly. Instead, the first time the route is needed, it will be imported dynamically and at that point added to in-memory cache.
Note: Not relevant for Cloudflare Pages, as all routes are bundled in that case anyway.
Adds a new utils module to core, enabling a simple Preact/React/etc. SSR/SPA mode
More on this later. Basically this just lets you use Hwy as an ultra-simple Vite alternative for, say, a classic Preact/React app with SSR. You wouldn't use the Hwy pages directory in this case. Instead, you'd just use Hwy as a build tool, static asset hasher/server, CSS bundler / critical CSS inliner, and dev server. Then you'd set up a basic server-rendered Hono/Preact app on top of it. It's quite nice, actually.
Fixes #45
Now you can import first-party modules (such as .env validators) into your Hwy config.
Fixes #47
Ensures your PORT environment variable, if any, will override your Hwy config
Fixes an issue where CSS URLs (e.g., url(fonts/ubuntu-mono.woff)) didn't work without quotation marks, which didn't cover all valid CSS syntax. Now fixed.
CSS hot reloading!
src/styles
.hwyConfig.dev.hotReloadCssBundle
tofalse
.esbuild
docs apply here. The method discussed there is basically what we're doing. See https://esbuild.github.io/api/#live-reload-caveats.Adds new route loading strategy choices
hwyConfig.routeStrategy
tobundle
,warm-cache-at-startup
,always-lazy
, orlazy-once-then-cache
. If nothing is explicitly set, the default will bealways-lazy
.bundle
: All your routes will be bundled into your server entry and always in memory.warm-cache-at-startup
: Your routes will be kept in separate modules, but on the first load of your server entry file, they'll all be eagerly imported and added to in-memory cache.always-lazy
: This is the standard behavior. Your routes will be kept in separate modules and imported dynamically when needed. They will not be explicitly added to any in-memory cache. Any caching would be handled however the applicable runtime handles module caching "under the hood".lazy-once-then-cache
: Likewarm
, but the modules won't be cached eagerly. Instead, the first time the route is needed, it will be imported dynamically and at that point added to in-memory cache.Adds a new
utils
module to core, enabling a simple Preact/React/etc. SSR/SPA modeFixes #45
.env
validators) into your Hwy config.Fixes #47
Ensures your
PORT
environment variable, if any, will override your Hwy configFixes an issue where CSS URLs (e.g.,
url(fonts/ubuntu-mono.woff)
) didn't work without quotation marks, which didn't cover all valid CSS syntax. Now fixed.Bumps dependencies and minor refactoring