vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

vue-i18n doesn't work with @rollup/plugin-yaml

Open mzenz opened this issue 2 years ago • 1 comments
trafficstars

Reporting a bug?

Adding yaml load support for Vite breaks vue-i18n and @nuxtjs/i18n.

Steps to reproduce

  1. git clone https://github.com/mzenz/nuxt-i18n-ssg-bug.git
  2. git switch dev
  3. yarn install
  4. yarn 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

mzenz avatar Jul 01 '23 16:07 mzenz

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.

kazupon avatar Jul 28 '23 06:07 kazupon