fix: delay module setup until modules:done#3501
fix: delay module setup until modules:done#3501BobbieGoede merged 1 commit intonuxt-modules:mainfrom
modules:done#3501Conversation
commit: |
|
Sorry for the inconvenience, but I recently learned modules should call their hooks in I'm not sure what your use case is for further modifying the routes after i18n, the module assumes it is among the last ones to modify the routes to be able to localize all registered routes. |
|
My use case is because I'm duplicating some routes with path modification to handle a limitation of vue-router, but those routes are also translated with pages: {
'shop/[...category]/page/[page]': {
en: '/product-category/[...category]/page/[page]',
hu: '/termek-kategoria/[...category]/page/[page]',
},But this means that if I run the route duplication before nuxt-i18n, this translation will not apply to the duplicated route, because the path differs, so I have to run it after and simply duplicate the already translated routes and modify them there (Now thinking I guess I could just edit the nuxt config to also duplicate the i18n pages rules as well during the pages:extend and run it before i18n) Could you look into the routeRules issue? As I'm sure this is not uncommon to add raw redirects for already translated content (seeing this was before this release the only way to do that). It seems the module now just tries to translate all the route rules, so maybe we just need a way to opt out in the rule, or check if the path already looks translated |

🔗 Linked issue
📚 Description
This delays most of the module setup until
modules:done, this ensures any modules that would like to hook into i18n build-time hooks such asi18n:registerModulehave had the chance to do so before all options are combined in the final config.