@@ -21,15 +21,13 @@ export default async function startDevServer(
21
21
cliOptions : any ,
22
22
logger : any ,
23
23
) : Promise < Record < string , unknown > [ ] > {
24
- let devServerVersion , Server , findPort ;
24
+ let devServerVersion , Server ;
25
25
26
26
try {
27
27
// eslint-disable-next-line node/no-extraneous-require
28
28
devServerVersion = require ( 'webpack-dev-server/package.json' ) . version ;
29
29
// eslint-disable-next-line node/no-extraneous-require
30
30
Server = require ( 'webpack-dev-server/lib/Server' ) ;
31
- // eslint-disable-next-line node/no-extraneous-require
32
- findPort = require ( 'webpack-dev-server/lib/utils/findPort' ) ;
33
31
} catch ( err ) {
34
32
logger . error ( `You need to install 'webpack-dev-server' for running 'webpack serve'.\n${ err } ` ) ;
35
33
process . exit ( 2 ) ;
@@ -71,9 +69,7 @@ export default async function startDevServer(
71
69
for ( const compilerWithDevServerOption of compilersWithDevServerOption ) {
72
70
const options = mergeOptions ( compilerWithDevServerOption . options . devServer || { } , devServerCliOptions ) ;
73
71
74
- if ( isDevServer4 ) {
75
- options . port = await findPort ( options . port ) ;
76
- } else {
72
+ if ( ! isDevServer4 ) {
77
73
const getPublicPathOption = ( ) : string => {
78
74
const normalizePublicPath = ( publicPath ) : string =>
79
75
typeof publicPath === 'undefined' || publicPath === 'auto' ? '/' : publicPath ;
@@ -87,11 +83,6 @@ export default async function startDevServer(
87
83
return normalizePublicPath ( options . publicPath ) ;
88
84
}
89
85
90
- // webpack-dev-server@4
91
- if ( options . dev && options . dev . publicPath ) {
92
- return normalizePublicPath ( options . dev . publicPath ) ;
93
- }
94
-
95
86
return normalizePublicPath ( compilerWithDevServerOption . options . output . publicPath ) ;
96
87
} ;
97
88
const getStatsOption = ( ) : string | boolean => {
0 commit comments