yarn - 配置本地代理路由到文件夹

在 proxy: { 同级位置添加

// 在这里添加本地文件路径映射
serverMiddleware: isDevMode ? [
{path: '/file', handler: serveStatic('D:/workSpace/xxx/files')},
{path: '/mom-file', handler: serveStatic('D:/workSpace/xxx/files')}
] : [],

在最外层添加判断条件

// 检测是否为开发模式
const isDevMode = process.env.NODE_ENV === 'development';

 

posted @ 2026-02-02 15:11  岑惜  阅读(3)  评论(0)    收藏  举报