-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
According to this article, It's very convenient to access env
by import it from as a virtual module like this
import { env } from "cloudflare:workers";
import { drizzle } from "drizzle-orm/d1";
export const db = drizzle(env.DB); // you can access `db` variable anywhere
This feature is supported by vite-plugin-cloudflare, and it does not works in honox project with following vite config:
import build from '@hono/vite-build/cloudflare-workers'
import adapter from '@hono/vite-dev-server/cloudflare'
import tailwindcss from '@tailwindcss/vite'
import honox from 'honox/vite'
import { defineConfig } from 'vite'
import { cloudflare } from "@cloudflare/vite-plugin"; // import the official plugin
export default defineConfig({
plugins: [
honox({
devServer: { adapter },
client: { input: ['./app/style.css'] },
}),
tailwindcss(),
build({}),
cloudflare() // used here
],
})
The error is still there, and I think the @hono/vite-build/cloudflare-workers
does not using workerd as runtime when i'm run the project using npm run dev
. How can I use the cloudflare:workers
package?
Metadata
Metadata
Assignees
Labels
No labels