refactor: add vite-plugin-html. Delete updateHtml related logic

This commit is contained in:
vben
2020-10-27 21:21:14 +08:00
parent 7bd0b8eb6f
commit 173d402162
19 changed files with 224 additions and 286 deletions

19
build/vite/proxy.ts Normal file
View File

@@ -0,0 +1,19 @@
type ProxyItem = [string, string];
type ProxyList = ProxyItem[];
const reg = /^https:\/\//;
export function createProxy(list: ProxyList = []) {
const ret: any = {};
for (const [prefix, target] of list) {
const isHttps = reg.test(target);
ret[prefix] = {
target: target,
changeOrigin: true,
rewrite: (path: string) => path.replace(new RegExp(`^${prefix}`), ''),
...(isHttps ? { secure: false } : {}),
};
}
return ret;
}