@intlify/unplugin-vue-i18n not support HMR with Static bundle importing

オープン
#299 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript, vite

調査の方向性

まず、vite.config.ts と main.ts に記載された再現手順を実行し、含まれている src/locales/en.json ファイルを使って、Vite のページリロード出力を確認します。プラグインが静的なバンドルインポートとロケールファイルの変更をどのように処理するかを追跡します。JSON を編集すると、ページを更新せずに HMR 経由で翻訳テキストが更新されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

good first issue
Reporting a bug?

Using "@intlify/unplugin-vue-i18n": "^1.2.0"

I've follow README.md's guide to setup my project like reproduction section.
And I put locale files to src/locales/en.json, i18n works fine but dev server will refresh page everytime when I update the json file.
And I got output like this:

11:39:17 AM [vite] page reload src/locales/en.json

Is my setting wrong? Thanks for help!

Expected behavior

When I saving only the text section update.

Reproduction
// vite.config.ts
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    UnoCSS(),
    VueI18nPlugin({
      include: [path.resolve(__dirname, './src/locales/**')],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
});
// main.ts
import messages from '@intlify/unplugin-vue-i18n/messages';

import App from './App.vue';

const app = createApp(App);

app.use(createPinia());
app.use(
  createI18n({
    legacy: false,
    locale: 'en',
    globalInjection: true,
    fallbackLocale: 'en',
    messages,
  }),
);
Issue Package

unplugin-vue-i18n

System Info
System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1
    Memory: 96.44 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - /usr/local/bin/node
    npm: 9.6.7 - /usr/local/bin/npm
    pnpm: 8.6.12 - ~/.npm-global/bin/pnpm
  Browsers:
    Chrome: 116.0.5845.187
    Safari: 16.5.2
  npmPackages:
    @intlify/unplugin-vue-i18n: ^1.2.0 => 1.2.0 
    vite: ^4.3.9 => 4.4.7 
    vue: ^3.3.4 => 3.3.4 
    vue-i18n: ^9.3.0 => 9.3.0
Screenshot

No response

Additional context

No response

Validations
  • Read the Contributing Guidelines.
  • Read the README
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion.
主要言語
TypeScript
スター
269
フォーク
45
平均マージ
3時間 54分
マージ済み PR(30日)
57

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

intlify/bundle-tools のほかの issue

intlify/bundle-tools の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。