mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxi): ignore error if nitro is not enabled on bridge (#22642)
This commit is contained in:
parent
33389dc4e0
commit
a522f1ee3a
@ -41,6 +41,7 @@
|
||||
"listhen": "1.3.0",
|
||||
"mlly": "1.4.0",
|
||||
"mri": "1.2.0",
|
||||
"nitropack": "^2.5.2",
|
||||
"ohash": "1.1.3",
|
||||
"pathe": "1.1.1",
|
||||
"perfect-debounce": "1.0.0",
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { relative, resolve } from 'pathe'
|
||||
import { consola } from 'consola'
|
||||
import type { Nitro } from 'nitropack'
|
||||
|
||||
// we are deliberately inlining this code as a backup in case user has `@nuxt/schema<3.7`
|
||||
import { writeTypes as writeTypesLegacy } from '../../../kit/src/template'
|
||||
@ -38,8 +39,12 @@ export default defineNuxtCommand({
|
||||
}
|
||||
})
|
||||
|
||||
// Use ? for backward compatibility for Nuxt <= RC.10
|
||||
const nitro = useNitro?.()
|
||||
let nitro: Nitro | undefined
|
||||
// In Bridge, if nitro is not enabled, useNitro will throw an error
|
||||
try {
|
||||
// Use ? for backward compatibility for Nuxt <= RC.10
|
||||
nitro = useNitro?.()
|
||||
} catch {}
|
||||
|
||||
await clearBuildDir(nuxt.options.buildDir)
|
||||
|
||||
|
@ -316,6 +316,9 @@ importers:
|
||||
mri:
|
||||
specifier: 1.2.0
|
||||
version: 1.2.0
|
||||
nitropack:
|
||||
specifier: ^2.5.2
|
||||
version: 2.5.2
|
||||
ohash:
|
||||
specifier: 1.1.3
|
||||
version: 1.1.3
|
||||
|
Loading…
Reference in New Issue
Block a user