Repository nuxt-i18n

Cannot read property 'pages' of undefined

northamerican
10
northamerican
commented 12 days ago

When running nuxt build, I get the following error:

  TypeError: Cannot read property 'pages' of undefined

  - module.js:62 Object.extendRoutes
    [my-site]/[nuxt-i18n]/src/module.js:62:34

  - utils.js:77 Object.extendRoutes
    [global]/[nuxt]/lib/common/utils.js:77:17

  - builder.js:266 Builder._callee3$
    [global]/[nuxt]/lib/builder/builder.js:266:50

I'm using [email protected]

Seems to work if i replace
/[nuxt-i18n]/src/module.js:61 with
pagesDir: this.options.rootDir + '/pages'

When i console.log(this.options) it appears to not have the dir property in it…

Reverting this line seems to work too:
https://github.com/nuxt-community/nuxt-i18n/commit/b2980cf1de713520b500cc15eb90e3f6b228ecb8#diff-47426efabbdf4a14eefdc36d3a774fc0L55

https://cmty.app/nuxt/nuxt-i18n/issues/c95

bug
0

Fixed in v5.0.2

10 days ago by paulgv

0
northamerican
10
northamerican
commented 12 days ago

@paulgv still having this issue for months ^

0
northamerican
10
northamerican
commented 12 days ago

my config:

const en = require('./locales/en.json')
const fr = require('./locales/fr.json')
['nuxt-i18n', {
      locales: [
        {
          code: 'en',
          iso: 'en-US',
          name: 'English'
        },
        {
           code: 'fr',
           iso: 'fr-CA',
           name: 'français'
        }
      ],
      vueI18n: {
        messages: {
          en,
          fr
        },
        fallbackLocale: 'en',
        silentTranslationWarn: true
      },
      defaultLocale: 'en',
      noPrefixDefaultLocale: true
    }],
0
paulgv
2.2k
paulgv
commented 11 days ago

Hi @northamerican
This should be fixed in v5.0.2, can you confirm?

Thanks!

0
northamerican
10
northamerican
commented 11 days ago

@paulgv i'm able to build without issues 👍

1
Informations
Bug ReportFixed
#c115 - Created 12 days ago