1
- import { defineNuxtModule , createResolver } from 'nuxt/kit'
1
+ import { defineNuxtModule , createResolver , logger } from 'nuxt/kit'
2
2
import { join } from 'pathe'
3
3
import { defu } from 'defu'
4
4
import { mkdir , writeFile , readFile } from 'node:fs/promises'
@@ -10,20 +10,17 @@ export default defineNuxtModule({
10
10
async setup ( _options , nuxt ) {
11
11
const { resolve } = createResolver ( import . meta. url )
12
12
13
- // Add Server utils based on environment
14
- // nuxt.options.nitro.imports = nuxt.options.nitro.imports || {}
15
- // nuxt.options.nitro.imports.dirs = nuxt.options.nitro.imports.dirs || []
16
- // nuxt.options.nitro.imports.dirs.push(resolve(`../server/_utils/${nuxt.options.dev ? 'dev' : 'prod'}/`))
17
-
18
13
// Production mode
19
14
if ( ! nuxt . options . dev ) {
20
15
return
21
16
}
22
17
23
18
if ( process . env . NUXT_HUB_URL ) {
24
19
// TODO: check on hub.nuxt.com if the project is connected
25
- // return
26
- // return once we support Proxy for all providers (R2 missing now)
20
+ logger . info ( `Using remote hub from \`${ process . env . NUXT_HUB_URL } \`` )
21
+ return
22
+ } else {
23
+ logger . info ( 'Using local hub from bindings' )
27
24
}
28
25
29
26
// Local development without remote connection
@@ -52,9 +49,6 @@ export default defineNuxtModule({
52
49
configPath : wranglerPath ,
53
50
persistDir : hubDir
54
51
} )
55
- // Make sure runtime is transpiled
56
- // nuxt.options.nitro.externals.inline = nuxt.options.nitro.externals.inline || []
57
- // nuxt.options.nitro.externals.inline.push(resolve('./runtime/server'))
58
52
// Add server plugin
59
53
nuxt . options . nitro . plugins = nuxt . options . nitro . plugins || [ ]
60
54
nuxt . options . nitro . plugins . push ( resolve ( './runtime/server/plugins/cloudflare.dev' ) )
@@ -69,4 +63,4 @@ kv_namespaces = [
69
63
]
70
64
r2_buckets = [
71
65
{ binding = "BLOB", bucket_name = "default" },
72
- ]`
66
+ ]`
0 commit comments