virmator 7.0.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,9 +36,24 @@ function alwaysReloadPlugin(config = {}) {
|
|
|
36
36
|
name: 'alwaysReloadPlugin',
|
|
37
37
|
apply: 'serve',
|
|
38
38
|
config: () => ({ server: { watch: { disableGlobbing: false } } }),
|
|
39
|
+
handleHotUpdate() {
|
|
40
|
+
return [];
|
|
41
|
+
},
|
|
39
42
|
configureServer({ watcher, ws, config: { logger, publicDir = '', root = process.cwd() } }) {
|
|
40
43
|
const { inclusions = [], exclusions = [] } = config;
|
|
41
44
|
let callingAlready = false;
|
|
45
|
+
const oldInfoLog = logger.info;
|
|
46
|
+
function customInfoLog(message, options) {
|
|
47
|
+
/**
|
|
48
|
+
* Ignore vite's built-in extra page reload logging as this will duplicate our
|
|
49
|
+
* messages.
|
|
50
|
+
*/
|
|
51
|
+
if (message.startsWith('page reload')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
oldInfoLog(message, options);
|
|
55
|
+
}
|
|
56
|
+
logger.info = customInfoLog;
|
|
42
57
|
function reloadCallback(path) {
|
|
43
58
|
// prevent duplicate calls cause the watcher is very eager to call callbacks multiple times in a row
|
|
44
59
|
if (!callingAlready) {
|
|
@@ -72,7 +87,6 @@ function alwaysReloadPlugin(config = {}) {
|
|
|
72
87
|
if (publicDir) {
|
|
73
88
|
watcher.add(publicDir);
|
|
74
89
|
}
|
|
75
|
-
watcher.removeAllListeners();
|
|
76
90
|
if (!watcher.listeners('change').includes(reloadCallback)) {
|
|
77
91
|
watcher.on('change', reloadCallback);
|
|
78
92
|
watcher.on('add', reloadCallback);
|