N
Nuxt3d ago
Yveeven

tsx and i18n conflict, parsing error

https://github.com/nuxt/nuxt/issues/31172#issuecomment-2692085277 Hi, I would like to ask if anyone has encountered the same situation.
2 Replies
kapa.ai
kapa.ai3d ago
Hi @Yveeven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I don't have enough specific details about the tsx and i18n conflict or parsing error you're referring to. The GitHub issue link you provided is not included in the given knowledge sources. However, I can offer some general insights about Nuxt and i18n integration that might be relevant: 1. When using i18n with Nuxt 3, it's important to properly configure it. The configuration should be split between nuxt.config.ts and i18n.config.ts files. As mentioned in this Stack Overflow answer, some configuration options should be in nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
vueI18n: './i18n.config.ts'
}
})
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
vueI18n: './i18n.config.ts'
}
})
2. There was a recent issue with Nuxt 3.15.3 that caused problems with module resolution, which might be related to your parsing error. This was discussed in a GitHub issue, and a workaround was provided:
export default defineNuxtConfig({
vite: {
ssr: {
noExternal: ['moment-timezone']
}
}
})
export default defineNuxtConfig({
vite: {
ssr: {
noExternal: ['moment-timezone']
}
}
})
However, this workaround should only be applied in development mode:
export default defineNuxtConfig({
vite: {
ssr: {
noExternal: process.env.NODE_ENV === 'development' ? ['moment-timezone'] : []
}
}
})
export default defineNuxtConfig({
vite: {
ssr: {
noExternal: process.env.NODE_ENV === 'development' ? ['moment-timezone'] : []
}
}
})
3. Regarding TSX specifically, there was a recent fix in Nuxt to conditionally use the tsx parser, as mentioned in this pull request. This change avoids using the tsx parser unless the file path matches tsx/jsx. If none of these points address your specific issue, I recommend providing more details about the exact error you're encountering and the versions of Nuxt and @nuxtjs/i18n you're using. This would help in providing a more accurate and targeted solution to your problem. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@969507618894803024> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?