Skip to content

Commit 551a7fb

Browse files
committed
fix(nuxthub): inherit preset form node/cloudflare
1 parent 9074b59 commit 551a7fb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/presets/nuxthub.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import nodePreset from './node'
1010

1111
export default definePreset({
1212
name: 'nuxthub',
13-
async setup(options, nuxt) {
13+
async setup(options, nuxt, config) {
1414
const nuxtOptions = nuxt.options as unknown as { hub: { db?: string | object | false, database?: boolean } }
1515
if (!nuxtOptions.hub?.db && !nuxtOptions.hub?.database) {
1616
logger.warn('NuxtHub dedected but the database is not enabled. Using local SQLite as default database instead.')
@@ -35,6 +35,13 @@ export default definePreset({
3535
options.database ||= { type: hubDb.driver as 'sqlite' | 'postgresql' | 'postgres' | 'libsql' | 'pglite', ...hubDb.connection } as unknown as SqliteDatabaseConfig | LibSQLDatabaseConfig | PGliteDatabaseConfig
3636
}
3737
}
38+
const preset = (process.env.NITRO_PRESET || nuxt.options.nitro.preset || provider).replace(/_/g, '-')
39+
if (preset.includes('cloudflare')) {
40+
await cloudflarePreset.setup?.(options, nuxt, config)
41+
}
42+
else {
43+
await nodePreset.setup?.(options, nuxt, config)
44+
}
3845
},
3946
async setupNitro(nitroConfig, options) {
4047
const { nuxt } = options as unknown as { nuxt: Nuxt & { options: { hub: { db?: boolean | object, database?: boolean } } } }

0 commit comments

Comments
 (0)