@@ -23,11 +23,11 @@ const serveIndex = require('serve-index');
23
23
const webpack = require ( 'webpack' ) ;
24
24
const webpackDevMiddleware = require ( 'webpack-dev-middleware' ) ;
25
25
const validateOptions = require ( 'schema-utils' ) ;
26
+ const isAbsoluteUrl = require ( 'is-absolute-url' ) ;
26
27
const normalizeOptions = require ( './utils/normalizeOptions' ) ;
27
28
const updateCompiler = require ( './utils/updateCompiler' ) ;
28
29
const createLogger = require ( './utils/createLogger' ) ;
29
30
const getCertificate = require ( './utils/getCertificate' ) ;
30
- const checkUrl = require ( './utils/checkUrl' ) ;
31
31
const status = require ( './utils/status' ) ;
32
32
const createDomain = require ( './utils/createDomain' ) ;
33
33
const runBonjour = require ( './utils/runBonjour' ) ;
@@ -339,7 +339,7 @@ class Server {
339
339
contentBase . forEach ( ( item ) => {
340
340
this . app . get ( '*' , express . static ( item ) ) ;
341
341
} ) ;
342
- } else if ( checkUrl ( contentBase ) ) {
342
+ } else if ( isAbsoluteUrl ( String ( contentBase ) ) ) {
343
343
this . log . warn (
344
344
'Using a URL as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.'
345
345
) ;
@@ -390,19 +390,22 @@ class Server {
390
390
contentBase . forEach ( ( item ) => {
391
391
this . app . get ( '*' , serveIndex ( item ) ) ;
392
392
} ) ;
393
- } else if ( typeof contentBase !== 'number' && ! checkUrl ( contentBase ) ) {
393
+ } else if (
394
+ typeof contentBase !== 'number' &&
395
+ ! isAbsoluteUrl ( String ( contentBase ) )
396
+ ) {
394
397
this . app . get ( '*' , serveIndex ( contentBase ) ) ;
395
398
}
396
399
}
397
400
398
401
setupWatchStaticFeature ( ) {
399
402
const contentBase = this . options . contentBase ;
400
403
401
- if ( checkUrl ( contentBase ) || typeof contentBase === 'number' ) {
404
+ if ( isAbsoluteUrl ( String ( contentBase ) ) || typeof contentBase === 'number' ) {
402
405
throw new Error ( 'Watching remote files is not supported.' ) ;
403
406
} else if ( Array . isArray ( contentBase ) ) {
404
407
contentBase . forEach ( ( item ) => {
405
- if ( checkUrl ( item ) || typeof item === 'number' ) {
408
+ if ( isAbsoluteUrl ( String ( item ) ) || typeof item === 'number' ) {
406
409
throw new Error ( 'Watching remote files is not supported.' ) ;
407
410
}
408
411
this . _watch ( item ) ;
0 commit comments