File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,8 @@ const DEFAULT_ALLOWED_PROTOCOLS = /^(file|.+-extension):/i;
311311 * @property {typeof useFn } use
312312 */
313313
314+ const pluginName = "webpack-dev-server" ;
315+
314316/**
315317 * @template {BasicApplication} [A=ExpressApplication]
316318 * @template {BasicServer} [S=HTTPServer]
@@ -330,7 +332,7 @@ class Server {
330332 /**
331333 * @type {ReturnType<Compiler["getInfrastructureLogger"]> }
332334 */
333- this . logger = this . compiler . getInfrastructureLogger ( "webpack-dev-server" ) ;
335+ this . logger = this . compiler . getInfrastructureLogger ( pluginName ) ;
334336 this . options = options ;
335337 /**
336338 * @type {FSWatcher[] }
@@ -3414,6 +3416,23 @@ class Server {
34143416 . then ( ( ) => callback ( ) , callback )
34153417 . catch ( callback ) ;
34163418 }
3419+
3420+ /**
3421+ * @param {Compiler } compiler compiler
3422+ * @returns {void }
3423+ */
3424+ apply ( compiler ) {
3425+ const pluginName = this . constructor . name ;
3426+ this . compiler = compiler ;
3427+
3428+ this . compiler . hooks . watchRun . tapPromise ( pluginName , async ( ) => {
3429+ await this . start ( ) ;
3430+ } ) ;
3431+
3432+ this . compiler . hooks . watchClose . tap ( pluginName , async ( ) => {
3433+ await this . stop ( ) ;
3434+ } ) ;
3435+ }
34173436}
34183437
34193438module . exports = Server ;
You can’t perform that action at this time.
0 commit comments