-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no working example for the layers #2242
Comments
Hmm, It seems that nuxt layers in nuxt i18n module still have bugs in monorepo projects. /cc @BobbieGoede |
@kleinpetr This issue seems to only be caused if a layer uses a config file I'm not familiar enough (yet) with how the proxy/transform code works exactly, but the error it's throwing seems to point in that direction if I understand correctly. |
@BobbieGoede |
related (same) issue #2073 |
@kazupon Looking at the generated // nested layer generates this import
import("\u0000@nuxtjs/i18n/__config__?target=../layer-nested/i18n.config.ts&hash=6596de27");
// a layer one directory up ('../layer/') generates this
import("\u0000@nuxtjs/i18n/__config__?target=../../layer/i18n.config.ts&hash=29e2a922");
// a layer two directories up ('../../layer-furthest/') generates this
import("\u0000@nuxtjs/i18n/__config__?target=../../../layer-furthest/i18n.config.ts&hash=50848308"); But the layers directories up relative to the project throw errors // a layer one directory up ('../layer/') error
[vite-node] [ERR_INVALID_ARG_VALUE] @nuxtjs/i18n/layer/i18n.config.ts&hash=29e2a922&from=./.nuxt/i18n.options.mjs
// a layer two directories up ('../../layer-furthest/') error
[vite-node] [ERR_INVALID_ARG_VALUE] @nuxtjs/layer-furthest/i18n.config.ts&hash=50848308&from=./.nuxt/i18n.options.mjs It seems that every directory level up more of the original path is replaced/removed, I'm assuming the expected path would start with
Maybe I'm missing something but based on this I think the issue is caused by the way the generated imports are handled and I'm not sure how to fix this 😅. Edit: |
have the same issue |
Thank you for your effort! I've just checked your reproduction. Your nuxt-devtools captures are of great help! we need help from the vite team! |
It looks like To demonstrate I ran > path.posix.normalize('@nuxt/i18n/__config__?target=./config.ts')
'@nuxt/i18n/__config__?target=./config.ts'
> path.posix.normalize('@nuxt/i18n/__config__?target=../config.ts')
'@nuxt/i18n/__config__?target=../config.ts'
> path.posix.normalize('@nuxt/i18n/__config__?target=../../config.ts')
'@nuxt/i18n/config.ts'
> path.posix.normalize('@nuxt/i18n/__config__?target=../../../config.ts')
'@nuxt/config.ts' I found a PR for a rollup plugin I will open an issue on the vite repository and see if I can implement a fix for this! |
It looks like #2265 fixes this issue, you can install the edge channel to use it until it is included in a release! I have installed the edge version to confirm that it works in your reproduction: https://stackblitz.com/edit/github-cthyca?file=package.json You can install the edge channel like so |
Environment
Reproduction
https://stackblitz.com/github/kleinpetr/nuxt-i18n-layers
Describe the bug
Hi I was waiting since my last issue #2092 but after a while I've tried to upgrade deps, i18n and Nuxt itself. but it seems that is still not working seamlessly.. What I would like to achieve
I have a layer which has its own logic, components and locales of course, this layer should be independent on his parent, so I would like to use i18n in the layer because the layer needs it. The project doesn't have to know if the layer uses i18n or not at the end (this is my opinion If I would keep Single Responsibility Purpose), and of course if I would like to overwrite something from the layer in the parent I should be able to do it, just by rewriting the
i18n.config.ts
So, is there any simple, straightforward, exmaple when the layer uses i18n?
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: