mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-25 02:58:40 +08:00
17 lines
374 B
TypeScript
17 lines
374 B
TypeScript
|
import { resolve } from 'path';
|
||
|
import type { Alias } from 'vite';
|
||
|
|
||
|
function pathResolve(dir: string) {
|
||
|
return resolve(__dirname, '.', dir);
|
||
|
}
|
||
|
|
||
|
export function createAlias(alias: [string, string][]): Alias[] {
|
||
|
return alias.map((item) => {
|
||
|
const [alia, src] = item;
|
||
|
return {
|
||
|
find: new RegExp(alia),
|
||
|
replacement: pathResolve(src) + '/',
|
||
|
};
|
||
|
});
|
||
|
}
|