perf: Use Imports Instead of Aliases

This commit is contained in:
vben
2024-06-16 23:40:52 +08:00
parent 07d1f85ff7
commit 6ffec31ce8
19 changed files with 41 additions and 140 deletions

View File

@@ -2,8 +2,6 @@ import type { UserConfig } from 'vite';
import type { DefineApplicationOptions } from '../typing';
import { resolve } from 'node:path';
import { defineConfig, loadEnv, mergeConfig } from 'vite';
import { getApplicationConditionPlugins } from '../plugins';
@@ -57,31 +55,6 @@ function defineApplicationConfig(options: DefineApplicationOptions = {}) {
legalComments: 'none',
},
plugins,
resolve: {
alias: [
{
find: /@\//,
replacement: `${resolve(root, '.', 'src')}/`,
},
/**
* 确保大仓内的子包,如果通过源码方式引用,可以直接使用@别名
*/
// {
// find: '@',
// replacement: '@',
// customResolver(source, importer) {
// if (source[0] === '@') {
// const realPath = source.replace(
// /^@/,
// resolve(findUpPackageDir(importer), 'src'),
// );
// return findFileByExtension(realPath);
// }
// return null;
// },
// },
],
},
server: {
host: true,
warmup: {