mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25: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 */) {
|
||||
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