Skip to content

Commit

Permalink
fix: safe fallback when getNuxtModuleVersion fails
Browse files Browse the repository at this point in the history
Fixes #379
  • Loading branch information
harlan-zw committed Nov 5, 2024
1 parent 8a71d68 commit 3625c11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default defineNuxtModule<ModuleOptions>({
const i18nModule = ['@nuxtjs/i18n', 'nuxt-i18n-micro'].find(s => hasNuxtModule(s))
if (i18nModule) {
const i18nVersion = await getNuxtModuleVersion(i18nModule)
if (i18nModule === '@nuxtjs/i18n' && !await hasNuxtModuleCompatibility(i18nModule, '>=8'))
if (i18nVersion && i18nModule === '@nuxtjs/i18n' && !await hasNuxtModuleCompatibility(i18nModule, '>=8'))
logger.warn(`You are using ${i18nModule} v${i18nVersion}. For the best compatibility, please upgrade to ${i18nModule} v8.0.0 or higher.`)
nuxtI18nConfig = (await getNuxtModuleOptions(i18nModule) || {}) as I18nIntegrationOptions
if (typeof nuxtI18nConfig.includeDefaultLocaleRoute !== 'undefined') {
Expand Down Expand Up @@ -257,7 +257,7 @@ export default defineNuxtModule<ModuleOptions>({
if (robotsModuleName) {
const robotsVersion = await getNuxtModuleVersion(robotsModuleName)
// we want to keep versions in sync
if (!await hasNuxtModuleCompatibility(robotsModuleName, '>=4'))
if (robotsVersion && !await hasNuxtModuleCompatibility(robotsModuleName, '>=4'))
logger.warn(`You are using ${robotsModuleName} v${robotsVersion}. For the best compatibility, please upgrade to ${robotsModuleName} v4.0.0 or higher.`)
else
needsRobotsPolyfill = false
Expand Down

0 comments on commit 3625c11

Please sign in to comment.