Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 tasks done
yoyoys opened this issue Sep 21, 2023 · 1 comment
Open
4 tasks done
Labels

Comments

@yoyoys
Copy link

yoyoys commented Sep 21, 2023

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.
@yoyoys yoyoys added the Status: Review Needed Request for review comments label Sep 21, 2023
@kazupon kazupon added Status: PR Welcome Welcome to Pull Request Package: unplugin-vue-i18n good first issue Good for newcomers and removed Status: Review Needed Request for review comments labels Sep 28, 2023 — with Volta.net
@cmdickson
Copy link

It looks like this is blocked by Vite issue #12912. If the code that was reverted as part of the PR referenced in the ticket is re-applied, then virtual module updates can be accepted, including the @intlify/unplugin-vue-i18n/messages virtual module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants