File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,27 @@ export const UnpluginInfo = createUnplugin<Options | undefined>((option) => {
99
99
. map ( ( [ key , value ] ) => `export const ${ key } = ${ JSON . stringify ( value , null , 2 ) } ;` )
100
100
. join ( '\n' ) ;
101
101
}
102
+ } ,
103
+ vite : {
104
+ handleHotUpdate ( { file, server } ) {
105
+ // HMR: package.json
106
+ if ( file === normalizePath ( path . resolve ( root , 'package.json' ) ) ) {
107
+ const module = server . moduleGraph . getModuleById ( '\0' + ModuleName . BuildPackage ) ;
108
+ if ( module ) {
109
+ // Invalidate module for reloading
110
+ server . moduleGraph . invalidateModule ( module ) ;
111
+
112
+ // Reload client
113
+ server . ws . send ( {
114
+ type : 'full-reload'
115
+ } ) ;
116
+ }
117
+ }
118
+ }
102
119
}
103
120
} ;
104
121
} ) ;
122
+
123
+ function normalizePath ( filename : string ) {
124
+ return filename . split ( path . win32 . sep ) . join ( path . posix . sep ) ;
125
+ }
You can’t perform that action at this time.
0 commit comments