Skip to content

Commit 259003e

Browse files
committed
fix(hmr): fix broken hmr
1 parent d87e2bb commit 259003e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/web/init-vue-app.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createPinia } from 'pinia';
22

33
import { createApp } from 'vue';
44

5-
import type { Component } from 'vue';
5+
import type { App, Component } from 'vue';
66

77
import type { RouterOptions } from '~/router';
88

@@ -20,3 +20,11 @@ export const initVueApp = (component: Component, options: InitVueAppOption = {})
2020

2121
return app;
2222
};
23+
24+
export const mountVueApp = (id = '#app', component: Component): App => {
25+
const app = initVueApp(component);
26+
27+
app.mount(id);
28+
29+
return app;
30+
};

vite.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const getPlugins = (): PluginOption[] => [
6262
});
6363
});
6464
},
65-
handleHotUpdate: async ({ server, file, read }) => {
65+
handleHotUpdate: async ({ server, file, read, modules }) => {
6666
const lang = file.match(i18nRegex)?.[1];
6767
if (lang) {
6868
console.info('Emit new i18n', file);
@@ -73,7 +73,7 @@ const getPlugins = (): PluginOption[] => [
7373
data: [{ lang, locale }],
7474
});
7575
}
76-
return [];
76+
return modules;
7777
},
7878
},
7979

0 commit comments

Comments
 (0)