From 7c01ee979e0776101c0f00bebca8a283d48cef6e Mon Sep 17 00:00:00 2001 From: qlin Date: Wed, 27 Nov 2024 11:31:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=A3=E7=90=86=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=20array=20=E5=86=99=E6=B3=95=20(#260)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/commands/dev/connectHistoryMiddleware.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/fes-builder-webpack/src/plugins/commands/dev/connectHistoryMiddleware.js b/packages/fes-builder-webpack/src/plugins/commands/dev/connectHistoryMiddleware.js index c6a7ec1f..065a66ac 100644 --- a/packages/fes-builder-webpack/src/plugins/commands/dev/connectHistoryMiddleware.js +++ b/packages/fes-builder-webpack/src/plugins/commands/dev/connectHistoryMiddleware.js @@ -6,8 +6,15 @@ const ASSET_EXT_NAMES = ['.ico', '.png', '.jpg', '.jpeg', '.gif', '.svg']; function proxyMiddleware(api) { return (req, res, next) => { const proxyConfig = api.config.proxy; - if (proxyConfig && Object.keys(proxyConfig).some(path => req.url.startsWith(path))) { - return next(); + if (proxyConfig) { + if (Array.isArray(proxyConfig)) { + if (proxyConfig.some(item => item.context.some(path => path && req.url.startsWith(path)))) { + return next(); + } + } + else if (Object.keys(proxyConfig).some(path => req.url.startsWith(path))) { + return next(); + } } if (ASSET_EXT_NAMES.includes(extname(req.url))) { return next();