Commit 82ca78d 1 parent cfc710f commit 82ca78d Copy full SHA for 82ca78d
File tree 1 file changed +8
-1
lines changed
packages/bundler-vite/src/server
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,14 @@ interface IOpts {
27
27
* it would be the modules of HMR Context before each HMR is sent
28
28
*/
29
29
onDevCompileDone ?: ( args : {
30
+ time : number ;
30
31
isFirstCompile : boolean ;
31
32
stats : HmrContext [ 'modules' ] | DepOptimizationMetadata ;
32
33
} ) => Promise < void > | void ;
33
34
}
34
35
35
36
export async function createServer ( opts : IOpts ) {
37
+ const startTms = + new Date ( ) ;
36
38
const { viteConfig, onDevCompileDone } = opts ;
37
39
const app = express ( ) ;
38
40
const vite = await createViteServer ( {
@@ -42,7 +44,11 @@ export async function createServer(opts: IOpts) {
42
44
? {
43
45
plugins : viteConfig . plugins ! . concat ( [
44
46
pluginOnHotUpdate ( async ( modules ) => {
45
- await onDevCompileDone ( { isFirstCompile : false , stats : modules } ) ;
47
+ await onDevCompileDone ( {
48
+ time : 0 ,
49
+ isFirstCompile : false ,
50
+ stats : modules ,
51
+ } ) ;
46
52
} ) ,
47
53
] ) ,
48
54
}
@@ -87,6 +93,7 @@ export async function createServer(opts: IOpts) {
87
93
server . listen ( port , async ( ) => {
88
94
if ( typeof onDevCompileDone === 'function' ) {
89
95
await onDevCompileDone ( {
96
+ time : + new Date ( ) - startTms ,
90
97
isFirstCompile : true ,
91
98
// @ts -ignore
92
99
stats : vite . _optimizeDepsMetadata ,
You can’t perform that action at this time.
0 commit comments