@@ -13,6 +13,7 @@ import * as WebpackDevServer from 'webpack-dev-server';
1313import * as SpeedMeasurePlugin from 'speed-measure-webpack-plugin' ;
1414import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin' ;
1515import { globalState } from './global-state' ;
16+ import { plugin } from './plugins' ;
1617import { tempPath , srcPath , packagesPath } from './structor-config' ;
1718import { logInfo } from './log' ;
1819import { getWebpackConfig , IOptions } from './webpack-config' ;
@@ -91,7 +92,7 @@ export const runWebpackDevServer = async (
9192 ) ;
9293 }
9394
94- const webpackDevServerConfig : WebpackDevServer . Configuration = {
95+ const defaultWebpackDevServerConfig : WebpackDevServer . Configuration = {
9596 host : globalState . sourceConfig . host ,
9697 hot : opts . hot ,
9798 hotOnly : opts . hot ,
@@ -130,6 +131,9 @@ export const runWebpackDevServer = async (
130131 port : opts . devServerPort ,
131132 contentBase : opts . contentBase ,
132133 } as any ;
134+ const webpackDevServerConfig = ( await plugin . devServerConfigPipes . reduce ( async ( newConfig , fn ) => {
135+ return fn ( await newConfig ) ;
136+ } , Promise . resolve ( defaultWebpackDevServerConfig ) ) ) as any ;
133137
134138 WebpackDevServer . addDevServerEntrypoints ( webpackConfig as any , webpackDevServerConfig ) ;
135139
@@ -144,17 +148,13 @@ export const runWebpackDevServer = async (
144148 const compiler = webpack ( webpackConfig ) ;
145149
146150 const devServer = new WebpackDevServer ( compiler as any , webpackDevServerConfig ) ;
151+ const { port, host, https } = webpackDevServerConfig ;
147152
148- devServer . listen ( opts . devServerPort , globalState . sourceConfig . host , ( ) => {
153+ devServer . listen ( port , host , ( ) => {
149154 let devUrl : string = null ;
150- const localSuggestUrl = urlJoin (
151- `${ opts . https || globalState . sourceConfig . useHttps ? 'https' : 'http' } ://${ globalState . sourceConfig . host } :${
152- opts . devServerPort
153- } `,
154- globalState . sourceConfig . baseHref ,
155- ) ;
155+ const localSuggestUrl = urlJoin ( `${ https ? 'https' : 'http' } ://${ host } :${ port } ` , globalState . sourceConfig . baseHref ) ;
156156
157- if ( opts . devUrl === globalState . sourceConfig . host ) {
157+ if ( opts . devUrl === host ) {
158158 devUrl = localSuggestUrl ;
159159 } else if ( opts . devUrl !== undefined ) {
160160 ( { devUrl } = opts ) ;
0 commit comments