Skip to content

Commit 322a544

Browse files
jevin98sleeprite
authored andcommitted
!457 chore(play): 改变文件后终端刷新打印Url入口
* chore(play): 改变文件后终端刷新打印Url入口
1 parent 1b988c9 commit 322a544

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { ViteDevServer } from "vite";
2+
3+
export default function HmrRefreshUrlLog() {
4+
let _cacheServer: ViteDevServer;
5+
6+
return {
7+
name: "vite-plugin-hmr-refresh-url-log",
8+
9+
configureServer(server: ViteDevServer) {
10+
_cacheServer = server;
11+
},
12+
13+
handleHotUpdate() {
14+
_cacheServer.config.logger.info("vite Server refresh");
15+
_cacheServer.printUrls && _cacheServer.printUrls();
16+
},
17+
};
18+
}

play/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { defineConfig } from "vite";
22
import vue from "@vitejs/plugin-vue";
33
import vueJsx from "@vitejs/plugin-vue-jsx";
4+
import HmrRefreshUrlLog from "./plugins/vite-plugin-hmr-refresh-url-log";
45
import "./vite.init";
56

67
export default defineConfig(() => {
78
return {
8-
plugins: [vue(), vueJsx()],
9+
plugins: [vue(), vueJsx(), HmrRefreshUrlLog()],
910
server: {
1011
host: true,
1112
open: true,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy