File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020 printSuccessfullyCompiledMessage ,
2121 printCompiledWithWarnMessage ,
2222 printFailedCompileMEssage ,
23+ printGeneralInfoMessage ,
2324} from './utils' ;
2425
2526/**
@@ -114,6 +115,10 @@ export function serve(options: ProgramOptions | undefined): void {
114115 }
115116 printWatchingMessage ( ) ;
116117 } ,
118+ onBsChange ( file ) {
119+ printGeneralInfoMessage ( `changed: ${ chalk . bold ( file ) } ` ) ;
120+ printGeneralInfoMessage ( 'reloading browser' ) ;
121+ } ,
117122 } ) ;
118123 server . serve ( ) ;
119124
Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ ${chalk.bold(gradient.instagram(` \\_/\\_/`))} ${chalk.magenta(
2727 'v'
2828) } ${ chalk . bold . magenta ( `${ pkg . version } ` ) } `;
2929
30+ export const wpackLogoSmall = gradient . instagram ( 'wpack.io' ) ;
31+
3032export function addTimeStampToLog ( log : string ) : string {
3133 const time = new Date ( ) . toTimeString ( ) . split ( ' ' ) [ 0 ] ;
32- return `${ chalk . dim ( `「wpack.io ${ time } 」` ) } ${ log } ` ;
34+ return `${ chalk . dim ( `「${ wpackLogoSmall } ${ time } 」` ) } ${ log } ` ;
3335}
3436
3537export const watchSymbol = `${ logSymbols . info } ` ;
@@ -77,8 +79,6 @@ export function printGeneralInfoMessage(msg: string) {
7779
7880export const bulletSymbol = chalk . magenta ( figures . pointer ) ;
7981
80- export const wpackLogoSmall = gradient . instagram ( 'wpack.io' ) ;
81-
8282export const wpackLink = `${ chalk . blue . underline ( 'https://wpack.io' ) } ` ;
8383
8484export const wpackIntro = `${ wpackLogo } \n` ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ interface Callbacks {
1616 firstCompile ( stats : webpack . Stats ) : void ;
1717 onError ( err : { errors : string [ ] ; warnings : string [ ] } ) : void ;
1818 onWarn ( warn : { errors : string [ ] ; warnings : string [ ] } ) : void ;
19+ onBsChange ( file : string ) : void ;
1920}
2021
2122/**
@@ -177,7 +178,10 @@ export class Server {
177178 if ( this . projectConfig . watch ) {
178179 bs . watch ( this . projectConfig . watch as string ) . on (
179180 'change' ,
180- bs . reload
181+ ( file : string ) => {
182+ this . callbacks . onBsChange ( file ) ;
183+ bs . reload ( ) ;
184+ }
181185 ) ;
182186 }
183187 // We don't need to watch for manifest, because if user is changing
You can’t perform that action at this time.
0 commit comments