File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11import rollupPlugin , { Options } from '@app-config/rollup' ;
2- import type { Plugin } from 'vite' ;
2+ import type { Plugin , FSWatcher } from 'vite' ;
33
44export * from '@app-config/rollup' ;
55
66export default function appConfigVite ( options : Options = { } ) : Plugin {
77 const plugin = rollupPlugin ( options ) ;
88
9+ let watcher : FSWatcher | undefined ;
10+
911 return {
1012 ...plugin ,
1113 name : '@app-config/vite' ,
1214
15+ configureServer ( server ) {
16+ watcher = server . watcher ;
17+ } ,
18+
19+ async load ( id ) {
20+ const result = await plugin . load ! . call ( this , id ) ;
21+
22+ watcher ?. add ( plugin . currentFilePaths ?? [ ] ) ;
23+
24+ return result ;
25+ } ,
26+
1327 async handleHotUpdate ( { server, file } ) {
1428 if ( plugin . currentFilePaths ?. includes ( file ) ) {
15- server . ws . send ( {
16- type : 'full-reload' ,
17- path : '@app-config/main' ,
18- } ) ;
29+ server . ws . send ( { type : 'full-reload' } ) ;
1930
2031 return [ ] ;
2132 }
You can’t perform that action at this time.
0 commit comments