#1494·vue-i18n

Trailing commas are breaking the json inside the i18n element

Author: EvandroLucasCreated Apr 21, 2022Updated Dec 13, 2024

Reporting a bug?

When using trailing commas in the i18n json, an error is thrown:

(Emitted value instead of an instance of Error) [vue-i18n-loader]: Unexpected token } in JSON at position 134

Expected behavior

The json parser should just ignore any trailing commas.

Reproduction

Just add any trailing comma into the i18n json, when using Single File Components.

System Info

bash
System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx
    Memory: 4.34 GB / 13.94 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.56)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @intlify/vue-i18n-loader: ^3.2.0 => 3.3.0
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.11
    @vue/cli-plugin-eslint: ^4.5.15 => 4.5.17
    @vue/cli-service: ~4.5.0 => 4.5.17
    @vue/eslint-config-airbnb: ^5.0.2 => 5.3.0
    vue: ^2.6.12 => 2.6.12
    vue-autonumeric: ^1.2.6 => 1.2.6
    vue-awesome: ^4.3.1 => 4.3.1
    vue-cli: ^2.9.6 => 2.9.6
    vue-cli-plugin-i18n: ~2.3.1 => 2.3.1
    vue-cli-plugin-vuetify: ~2.4.6 => 2.4.6
    vue-clipboards: ^1.3.0 => 1.3.0
    vue-confirm-dialog: ^1.0.2 => 1.0.2
    vue-fragment: 1.5.2 => 1.5.2
    vue-head: ^2.2.0 => 2.2.0
    vue-i18n: ^8.26.3 => 8.27.1
    vue-i18n-bridge: ^9.2.0-beta.10 => 9.2.0-beta.34
    vue-json-component: ^0.4.1 => 0.4.1
    vue-moment: ^4.1.0 => 4.1.0
    vue-router: ^3.5.1 => 3.5.1
    vue-search-select: ^2.9.3 => 2.9.3
    vue-sweetalert2: ^5.0.2 => 5.0.2
    vue-template-compiler: ^2.6.11 => 2.6.12
    vue-the-mask: ^0.11.1 => 0.11.1
    vuelidate: ^0.7.6 => 0.7.6
    vuetify: ^2.6.0 => 2.6.3
    vuetify-loader: ^1.7.0 => 1.7.3
    vuetify-mask-with-slots: ~1.1.6 => 1.1.6
    vuex: ^3.6.2 => 3.6.2

Screenshot

No response

Additional context

No response

Validations