Skip to content

Commit

Permalink
fix: support also cloudflare-module preset
Browse files Browse the repository at this point in the history
Resolves #93
  • Loading branch information
atinux committed May 3, 2024
1 parent d9ecba2 commit 89cf607
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,15 @@ export default defineNuxtModule<ModuleOptions>({
}

if (!nuxt.options.dev) {
// Make sure we force the cloudflare-pages preset
nuxt.options.nitro.preset = 'cloudflare-pages'
// Make sure to fallback to cloudflare-pages preset
let preset = nuxt.options.nitro.preset = nuxt.options.nitro.preset || 'cloudflare-pages'
// Support also cloudflare_module
preset = String(preset).replace('_', '-')

if (preset !== 'cloudflare-pages' && preset !== 'cloudflare-module') {
log.error('NuxtHub is only compatible with the `cloudflare-pages` and `cloudflare-module` presets.')
process.exit(1)
}
}

if (hub.remote) {
Expand Down

0 comments on commit 89cf607

Please sign in to comment.