Skip to content

Commit 143c337

Browse files
committed
refactor: Add accept HMR
1 parent bdb7054 commit 143c337

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/web/assets/src/js/app.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
// Import our CSS
22
import '@/css/app.css';
3+
4+
// Accept HMR as per: https://vitejs.dev/guide/api-hmr.html
5+
if (import.meta.hot) {
6+
import.meta.hot.accept(() => {
7+
console.log("HMR")
8+
});
9+
}

src/web/assets/src/js/welcome.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import App from '@/vue/App.vue';
2-
import { createApp } from 'vue';
2+
import {createApp} from 'vue';
33

44
// App main
55
const main = async () => {
6-
// Create our vue instance
7-
const app = createApp(App);
8-
// Mount the app
9-
const root = app.mount('#app-container');
6+
// Create our vue instance
7+
const app = createApp(App);
8+
// Mount the app
9+
const root = app.mount('#app-container');
1010

11-
return root;
11+
return root;
1212
};
1313

1414
// Execute async function
15-
main().then( () => {
16-
console.log();
15+
main().then(() => {
16+
console.log();
1717
});
18+
19+
// Accept HMR as per: https://vitejs.dev/guide/api-hmr.html
20+
if (import.meta.hot) {
21+
import.meta.hot.accept(() => {
22+
console.log("HMR")
23+
});
24+
}

0 commit comments

Comments
 (0)