Warning from i18n module about preview.vue

I'm building a Nuxt site with the Nuxt i18n module and the Prismic module. It seems to build fine and run fine, although I've still not tried the "preview" feature, except when I do a dev or production build, I get this warning from Nuxt:

WARN [@nuxtjs/i18n] Couldn't read page component file (ENOENT: no such file or directory, open '/site-path/.nuxt/prismic/pages/preview.vue')

If I run generate and see a list of the routes it builds, I see this:

ℹ Generating pages                                                    22:56:40
✔ Generated route "/fr"                                               22:56:42
✔ Generated route "/preview"                                          22:56:42
✔ Generated route "/en"                                               22:56:42
✔ Generated route "/fr/preview"                                       22:56:42
✔ Generated route "/en/preview"                                       22:56:42
✔ Generated route "/"                                                 22:56:42
✔ Generated route "/fr/test"                                          22:56:44
✔ Generated route "/test"                                             22:56:44
✔ Generated route "/en/test"   

I suppose the preview file may not be found because i18n is forcing this route parameter of /en or /fr

My i18n module config is:

    // i18n module configuration: https://i18n.nuxtjs.org/setup
    i18n: {
        locales: ['en', 'fr'],
        defaultLocale: 'en',
        // add /en/ URL prefix
        strategy: 'prefix',
    },

Is this something I can fix in the configuration? I will soon want to use the Preview feature.

Hi Duncan,

You should be able to ignore this route in your i18n setup as follows:

Let me know if this helps.

Thanks.

Would that be just the "/preview" route with no locale prefix that I want to ignore?

Hey Duncan,

I'm not sure, I've never used this plugin, but from the docs it seems like that's what is needed. So something like:

['@nuxtjs/i18n', {
  parsePages: false,
  pages: {
    preview: false
  }
}]

Thanks.

Thanks, Phil. I wasn't sure about the consequences of disabling parsePages, but it looks like that fixed the build warning, and the app still works as expected :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.