Skip to content

Commit

Permalink
fix: workaround rollup issue
Browse files Browse the repository at this point in the history
nuxt/framework#8213
  • Loading branch information
pi0 committed Oct 15, 2022
1 parent d5bbdeb commit b884d0c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { findWorkspaceDir } from 'pkg-types'
import { resolvePath, detectTarget } from './utils'
import type { NitroConfig, NitroOptions, NitroRouteConfig, NitroRouteOptions } from './types'
import { runtimeDir, pkgDir } from './dirs'
import * as PRESETS from './presets'
import * as _PRESETS from './presets'
import { nitroImports } from './imports'

const NitroDefaults: NitroConfig = {
Expand Down Expand Up @@ -110,17 +110,17 @@ export async function loadOptions (configOverrides: NitroConfig = {}): Promise<N
},
defaults: NitroDefaults,
resolve (id: string) {
type PT = Map<String, NitroConfig>
let matchedPreset = (PRESETS as any as PT)[id] || (PRESETS as any as PT)[camelCase(id)]
if (matchedPreset) {
if (typeof matchedPreset === 'function') {
matchedPreset = matchedPreset()
}
return {
config: matchedPreset
}
const presets = _PRESETS as any as Map<String, NitroConfig>
let matchedPreset = presets[camelCase(id)] || presets[id]
if (!matchedPreset) {
return null
}
if (typeof matchedPreset === 'function') {
matchedPreset = matchedPreset()
}
return {
config: matchedPreset
}
return null
}
})
const options = klona(config) as NitroOptions
Expand Down

0 comments on commit b884d0c

Please sign in to comment.