Skip to content

Commit

Permalink
fix: warn when @nuxtjs/i18n is installed without locales
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 3, 2024
1 parent ff61e22 commit 863b0ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export default defineNuxtModule<ModuleOptions>({
if (Array.isArray(config.excludeAppSources))
config.excludeAppSources.push('nuxt:pages')
}
else {
if (!normalisedLocales.length)
logger.warn('You are using @nuxtjs/i18n but have not configured any locales, this will cause issues with nuxt-simple-sitemap. Please configure `locales`.')
}
const hasSetAutoI18n = typeof config.autoI18n === 'object' && Object.keys(config.autoI18n).length
const hasI18nConfigForAlternatives = nuxtI18nConfig.differentDomains || usingI18nPages || (nuxtI18nConfig.strategy !== 'no_prefix' && nuxtI18nConfig.locales)
if (!hasSetAutoI18n && !hasDisabledAutoI18n && hasI18nConfigForAlternatives) {
Expand Down

0 comments on commit 863b0ec

Please sign in to comment.