intlify / intlify/bundle-tools
@intlify/unplugin-vue-i18n not support HMR with Static bundle importing
- Dominant language
- TypeScript
- Stars
- 270
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
### 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)),
},
},
});
```
```ts
// 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
```shell
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
- [X] Read the [Contributing Guidelines](https://github.com/intlify/bundle-tools/blob/main/.github/contributing.md).
- [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](https://github.com/intlify/bundle-tools/discussions).
Contributor guide
Assessment
This issue has not been assessed yet.