mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
fix(kit): ensure getNuxtVersion
returns string
(#28125)
This commit is contained in:
parent
057cfa99bf
commit
e102d1d444
@ -118,8 +118,8 @@ export function isNuxt3 (nuxt: Nuxt = useNuxt()) {
|
||||
*/
|
||||
export function getNuxtVersion (nuxt: Nuxt | any = useNuxt() /* TODO: LegacyNuxt */) {
|
||||
const rawVersion = nuxt?._version || nuxt?.version || nuxt?.constructor?.version
|
||||
if (!rawVersion) {
|
||||
throw new Error('Cannot determine nuxt version! Is current instance passed?')
|
||||
if (typeof rawVersion !== 'string') {
|
||||
throw new TypeError('Cannot determine nuxt version! Is current instance passed?')
|
||||
}
|
||||
return rawVersion.replace(/^v/g, '')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user