1.0.2 • Published 2 years ago
astro-bun-adapter v1.0.2
astro-bun-adapter
Allows Astro to run your SSR site with the Bun's native API
Bun.serve.
Fix the astro-bun adapter's issue, serving static files.
Prerequisites
- Bun
Installation
- Install
astro-bun-adapterpackage
bun i astro-bun-adapter- Update your
astro.config.mjsto useastro-bunadapter.
// astro.config.mjs
import { defineConfig } from 'astro/config';
import bun from 'astro-bun-adapter';
export default defineConfig({
output: 'server',
adapter: bun(),
});- Build your project.
bunx --bun astro buildThis will generate an entry.mjs script inside ./dist/server.
- Run the
entry.mjsscript.
bun run ./dist/server/entry.mjsor, you can update the preview script in you package.json.
// package.json
{
// ...
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "bun run ./dist/server/entry.mjs"
}
}and then just run:
bunx --bun astro preview