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