Skip to content

Commit

Permalink
fix: set up non-default ipx providers if options.ipx is set (#1618)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatcould authored Dec 6, 2024
1 parent a7affe8 commit 72e6bfb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,23 @@ ${providers.map(p => ` ['${p.name}']: { provider: ${p.importName}, defaults: ${
})

nuxt.hook('nitro:init', async (nitro) => {
if (!options.provider || options.provider === 'ipx' || options.provider === 'ipxStatic') {
if (!options.provider || options.provider === 'ipx' || options.provider === 'ipxStatic' || options.ipx) {
const resolvedProvider = nitro.options.static || options.provider === 'ipxStatic'
? 'ipxStatic'
: nitro.options.node ? 'ipx' : 'none'

imageOptions.provider = options.provider = resolvedProvider
options[resolvedProvider] = options[resolvedProvider] || {}
if (!options.provider || options.provider === 'ipx' || options.provider === 'ipxStatic') {
imageOptions.provider = options.provider = resolvedProvider
}

// initialise provider options
if (resolvedProvider === 'ipxStatic') {
// handle the case of `ipx: {}` existing in options, but deploying a static site
options.ipxStatic ||= options.ipx || {}
}
else {
options[resolvedProvider] = options[resolvedProvider] || {}
}

const p = await resolveProvider(nuxt, resolvedProvider, {
options: options[resolvedProvider],
Expand Down

0 comments on commit 72e6bfb

Please sign in to comment.