bundle-tools icon indicating copy to clipboard operation
bundle-tools copied to clipboard

vite-plugins-vue-i18n will listens for changes to all .json files

Open hooray opened this issue 3 years ago • 7 comments

Reporting a bug?

When I use the vite-plugins-vue-i18n plugin, it listens for changes to all the .json files in the project and causes vite to keep reloading

Expected behavior

should only listen to the directory specified by the include parameter

Reproduction

// vite.config.js
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueI18n from '@intlify/vite-plugin-vue-i18n'

export default defineConfig({
  plugins: [
    vue(), // you need to install `@vitejs/plugin-vue`
    vueI18n({
      // if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
      // compositionOnly: false,

      // you need to set i18n resource including paths !
      include: path.resolve(__dirname, './path/to/src/locales/**')
    })
  ]
})
// main.js

// When I import this line of code, the problem arises
import messages from '@intlify/vite-plugin-vue-i18n/messages'

Issue Package

vite-plugin-vue-i18n

System Info

windows 10

Screenshot

image image

Additional context

No response

Validations

  • [x] Read the Contributing Guidelines.
  • [X] Read the README
  • [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 Discussion.

hooray avatar May 02 '22 17:05 hooray

it also doesn't listen for languages in node_modules.

    VueI18n({
      include: [
        resolve(__dirname, '../../node_modules/@oku/i18n/src/locales/**'),
      ],
    }),
    

how to listen ?

productdevbook avatar Jun 08 '22 19:06 productdevbook

unplugin-vue-i18n the same problem occurs. image image image

momtboy avatar Mar 10 '23 02:03 momtboy

@kazupon Any updates on this one?

staniel359 avatar Apr 03 '23 14:04 staniel359

If you would use to possible, I recommend to use unplugin-vue-i18n.

vite-plugin-vue-i18n only supports up to Vite 3, support security fix only.

unplugin-vue-i18n is going to official v1 release, when nuxt i18n module will have been released near the future. (unplugin-vue-i18n is currently under development with me along with use cases for the nuxt i18n module)

kazupon avatar Apr 03 '23 15:04 kazupon

@kazupon I do use unplugin-vue-i18n. And the problem is that it also listens to changes of all .json files in the project's folder. Even when include option contains only locales folder. How can it be fixed?

staniel359 avatar Apr 03 '23 15:04 staniel359

@kazupon I do use unplugin-vue-i18n. And the problem is that it also listens to changes of all .json files in the project's folder. Even when include option contains only locales folder. How can it be fixed?

@kazupon I have the same problem,until now there is no solution, the same is used unplugin-vue-i18n .

momtboy avatar Apr 11 '23 12:04 momtboy