xiCO2k / laravel-vue-i18n

Allows to connect your `Laravel` Framework translation files with `Vue`.
MIT License
584 stars 49 forks source link

php_*.json translation files are deleted on 'yarn dev' restart #135

Closed pdazcom closed 1 year ago

pdazcom commented 1 year ago

Laravel v10.13.1 VITE v4.3.9 Inertia v1.0.7

when I run "yarn dev" everything is fine and php_en.json is created, but if I press "r" to restart, php_en.json is deleted.

my vite.config.js:

server: {
  port: 5173,  // exposed docker image port
  host: true,
  hmr: {
    host: process.env.VITE_HMR_HOST || 'localhost',
    port: 5173, // exposed docker image port
    clientPort: 5173, // mapped docker container port
  },
},
plugins: [
  //...
  i18n(),
],

in app.js:

.use(i18nVue, {
  resolve: async lang =>
    const langs = import.meta.glob('../../lang/*.json');
    if (typeof langs[`../../lang/${lang}.json`] == "undefined") return; //Temporary workaround
    return await langs[`../../lang/${lang}.json`]();
  },
});
xiCO2k commented 1 year ago

nice catch, will check if I can know if there is a restart.

xiCO2k commented 1 year ago

Should be fixed.