File tree 2 files changed +14
-0
lines changed
packages/vite-plugin-cloudflare-functions/src/vite
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ export function CloudflarePagesFunctions(userConfig: UserConfig = {}): Plugin {
61
61
bindings . push ( kv ) ;
62
62
}
63
63
}
64
+ if ( userConfig . wrangler ?. d1 ) {
65
+ const d1s = Array . isArray ( userConfig . wrangler . d1 )
66
+ ? userConfig . wrangler . d1
67
+ : [ userConfig . wrangler . d1 ] ;
68
+ for ( const d1 of d1s ) {
69
+ bindings . push ( '--d1' ) ;
70
+ bindings . push ( d1 ) ;
71
+ }
72
+ }
64
73
if ( userConfig . wrangler ?. do ) {
65
74
for ( const [ key , value ] of Object . entries ( userConfig . wrangler . do ) ) {
66
75
bindings . push ( '--do' ) ;
Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ export interface UserConfig {
51
51
*/
52
52
kv ?: string | string [ ] ;
53
53
54
+ /**
55
+ * Bind D1 database
56
+ */
57
+ d1 ?: string | string [ ] ;
58
+
54
59
/**
55
60
* Bind Durable Object
56
61
*/
You can’t perform that action at this time.
0 commit comments