nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.7k stars 474 forks source link

Support Nuxt Bridge at v7.3 codebase #1626

Open kazupon opened 1 year ago

kazupon commented 1 year ago

I mean we should first provide a version of nuxtjs/i18n v7.4 on the nuxt bridge that is guaranteed to work with the options API so that the nuxt community can migrate to nuxtjs/i18n v8.

We believe that by preparing in the above release roadmap, it will be possible to migrate incrementally to nuxt2 + nuxtjs/i18n v7, -> nuxt2 + nuxt bridge + nuxtjs/i18n v7.4 or v7.5, and finally nuxt3 + nuxtjs/i18n v8.

_Originally posted by @kazupon in https://github.com/nuxt-community/i18n-module/pull/1521#discussion_r975451777_

kazupon commented 1 year ago

We need test on @nuxtjs/i18n v7.3 code base + nuxt edge! If e2e test will be passed, we can release @nuxtjs/i18n v7.4

rchl commented 1 year ago

nuxt edge!

Why Nuxt Edge? I think it should work on latest stable.

kazupon commented 1 year ago

We don't still announce officially 📢 I believe it is necessary for me to pass the e2e test to pass that it works correctly ✅

rchl commented 1 year ago

We don't support it officially, yes, but my question is: why do you think that we should be testing on "nuxt edge" rather than on the latest Nuxt 2 stable? Does latest stable not yet include needed functionality?

kazupon commented 1 year ago

Nuxt Bridge is a nuxt module running on Nuxt2 (accurately, it's edge version called bynuxt-edge). Nuxt Bridge backports some features and APIs from Nuxt3.

This module is loosely coupled with Nuxt module. Although it should not do anything to affect Nuxt modules using other modules such as @nuxtjs/i18n, I think it's necessary to test that @nuxtjs/i18n works on Nuxt2 + Nuxt Bridge to assure that it works.

rchl commented 1 year ago

Then nuxt bridge should be released in a stable version first that supports stable nuxt 2 version.

Requiring nuxt-edge won't be an option for many production services that need to not randomly break.

tdebooij commented 1 year ago

Hi guys,

Is there any statusupdate on this issue? In the gh discussion I see the following line:

Fortunately, the latest stable version of nuxtjs/i18n, v7.2.2 works in the nuxt bridge environment as far as I have checked.

But for me, it's just spouting vm.$t is undefined when running with Vite. It does find it when running with webpack though. Any suggestions for a workaround maybe?

wJoenn commented 8 months ago

@kazupon something that I don't see mentionned is to backport Vite support too. Bridge enables Vite in Nuxt 2 applications but @nuxtjs/i18n@7 doesn't enable Vite to parse custom <i18> blocks in SPCs because vue-loader-i18n only works for Webpack and unplugin-vue-i18n is introduced in v8 which isn't compatible with Nuxt 2/Bridge

I wrote an issue about this in bridge but I'm starting to wonder whether I should have written it here instead of not https://github.com/nuxt/bridge/issues/1029

wJoenn commented 8 months ago

I tried installing unplugin-vue-i18n manually and make it work with @nuxtjs/i18n@7 but I get a breaking error saying

Uncaught SyntaxError: The requested module '/_nuxt/node_modules/@nuxtjs/i18n/node_modules/ufo/dist/index.cjs?import&v=0a01e4b0' does not provide an export named 'hasProtocol' (at plugin.utils.js:2:1)

From what I understand, version 7 just isn't compatible with unplugin-vue-i18n so installing it separetely and enabling it from the config like this doesn't work

  vite: {
    plugins: [
      VueI18nPlugin.vite({})
    ]
  },

Looks like Vite won't work until migrating to Nuxt 3 for the time beeing.