UNPKG

@cyber-tools/spa-build-tools

Version:

单页应用核心构建组件

20 lines (19 loc) 694 B
const path = require("path"); const glob = require("glob"); const { promisify } = require("es6-promisify"); module.exports = async function () { try { const matchPath = path.resolve(process.cwd(), "./proxy/**/*.js"); const matchPathList = await promisify(glob)(matchPath); const proxyConfigList = matchPathList.map((filePath) => { return require(filePath); }); return Object.assign.apply({}, [{}, ...proxyConfigList]); } catch (error) { throw error; }; // const proxyConfigResolve = require.resolve("./proxy.config", { // paths: [process.cwd(), path.resolve(__dirname, "../configs/defaultConfig/")] // }); // return require(proxyConfigResolve); };