File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,8 @@ class Server {
171
171
}
172
172
173
173
setupProxyFeature ( ) {
174
+ const { createProxyMiddleware } = require ( 'http-proxy-middleware' ) ;
175
+
174
176
/**
175
177
* Assume a proxy configuration specified as:
176
178
* proxy: {
@@ -243,8 +245,6 @@ class Server {
243
245
// It is possible to use the `bypass` method without a `target`.
244
246
// However, the proxy middleware has no use in this case, and will fail to instantiate.
245
247
if ( proxyConfig . target ) {
246
- const { createProxyMiddleware } = require ( 'http-proxy-middleware' ) ;
247
-
248
248
return createProxyMiddleware ( context , proxyConfig ) ;
249
249
}
250
250
} ;
@@ -341,11 +341,11 @@ class Server {
341
341
}
342
342
343
343
setupStaticServeIndexFeature ( ) {
344
+ const serveIndex = require ( 'serve-index' ) ;
345
+
344
346
this . options . static . forEach ( ( staticOption ) => {
345
347
staticOption . publicPath . forEach ( ( publicPath ) => {
346
348
if ( staticOption . serveIndex ) {
347
- const serveIndex = require ( 'serve-index' ) ;
348
-
349
349
this . app . use ( publicPath , ( req , res , next ) => {
350
350
// serve-index doesn't fallthrough non-get/head request to next middleware
351
351
if ( req . method !== 'GET' && req . method !== 'HEAD' ) {
You can’t perform that action at this time.
0 commit comments