@@ -8,10 +8,7 @@ const fs = require('graceful-fs');
8
8
const ipaddr = require ( 'ipaddr.js' ) ;
9
9
const internalIp = require ( 'internal-ip' ) ;
10
10
const killable = require ( 'killable' ) ;
11
- const chokidar = require ( 'chokidar' ) ;
12
11
const express = require ( 'express' ) ;
13
- const { createProxyMiddleware } = require ( 'http-proxy-middleware' ) ;
14
- const historyApiFallback = require ( 'connect-history-api-fallback' ) ;
15
12
const compress = require ( 'compression' ) ;
16
13
const serveIndex = require ( 'serve-index' ) ;
17
14
const webpack = require ( 'webpack' ) ;
@@ -246,6 +243,8 @@ class Server {
246
243
// It is possible to use the `bypass` method without a `target`.
247
244
// However, the proxy middleware has no use in this case, and will fail to instantiate.
248
245
if ( proxyConfig . target ) {
246
+ const { createProxyMiddleware } = require ( 'http-proxy-middleware' ) ;
247
+
249
248
return createProxyMiddleware ( context , proxyConfig ) ;
250
249
}
251
250
} ;
@@ -319,6 +318,8 @@ class Server {
319
318
}
320
319
321
320
setupHistoryApiFallbackFeature ( ) {
321
+ const historyApiFallback = require ( 'connect-history-api-fallback' ) ;
322
+
322
323
const fallback =
323
324
typeof this . options . historyApiFallback === 'object'
324
325
? this . options . historyApiFallback
@@ -1050,6 +1051,8 @@ class Server {
1050
1051
interval,
1051
1052
} ;
1052
1053
1054
+ const chokidar = require ( 'chokidar' ) ;
1055
+
1053
1056
const watcher = chokidar . watch ( watchPath , finalWatchOptions ) ;
1054
1057
1055
1058
// disabling refreshing on changing the content
0 commit comments