vue-i18n
vue-i18n copied to clipboard
vue-i18n doesn't work with @rollup/plugin-yaml
Reporting a bug?
Adding yaml load support for Vite breaks vue-i18n and @nuxtjs/i18n.
Steps to reproduce
git clone https://github.com/mzenz/nuxt-i18n-ssg-bug.gitgit switch devyarn installyarn dev
Results
Development server errors out with the following log:
ERROR end of the stream or a document separator is expected (2:9) 1:45:53 PM
1 | const resource = {
2 | "flag": (()=>{const fn=(ctx) => {const ...
-------------^
3 | "welcome": (()=>{const fn=(ctx) => {co ...
4 | "language": (()=>{const fn=(ctx) => {c ... (x2)
Expected behavior
Development server should run normally.
Reproduction
https://github.com/mzenz/nuxt-i18n-ssg-bug/tree/dev
System Info
System:
OS: macOS 13.4.1
CPU: (4) x64 Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
Memory: 465.62 MB / 16.00 GB
Shell: 3.5.1 - /usr/local/bin/fish
Binaries:
Node: 18.16.0 - /usr/local/opt/node@18/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.1 - /usr/local/opt/node@18/bin/npm
Screenshot
No response
Additional context
No response
Validations
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussions
Thank you for your reprorting!
It seem that the yaml file has been handled with @rollup/plugin-yaml after being transformed by unplugin-vue-i18n, which vue-i18n (nuxt i18n) uses internally.
Sorry, I couldn't figure out how you set up the @rollup/plugin-yaml in your reproduced code. You can work around this by setting the options so that the yaml processed by @rollup/plugin-yaml does not conflict with nuxt i18n.
Your yaml is handle with langDir options directory.