-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feature request: vite plugin with sveltekit #8922
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestvite-pluginRelating to the `@cloudflare/vite-plugin` packageRelating to the `@cloudflare/vite-plugin` package
Description
Which Cloudflare product(s) does this pertain to?
Vite Plugin
What versions & operating system are you using?
macOS
Please provide a link to a minimal reproduction
No response
Describe the Bug
I am trying to access a D1 database defined in my wrangler.jsonc. The documentation for the svelte plugin make it seem as though it should just work but I don't see a database in my hooks.server.ts.
import type { Handle } from "@sveltejs/kit";
import { DB } from '$env/static/private';
export const handle: Handle = async ({ event, resolve }) => {
// all undefined
console.log(process.env.DB, import.meta.env.DB, DB);
}
svelte config
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
};
export default config;
vite config
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { cloudflare } from "@cloudflare/vite-plugin";
export default defineConfig({
plugins: [sveltekit(), cloudflare()]
});
Please provide any relevant error logs
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestvite-pluginRelating to the `@cloudflare/vite-plugin` packageRelating to the `@cloudflare/vite-plugin` package