refactor(projects): 代码优化

This commit is contained in:
Soybean
2022-04-27 19:01:54 +08:00
parent e8488e4d52
commit a782461453
20 changed files with 174 additions and 138 deletions

View File

@ -1,20 +1,23 @@
import { fileURLToPath } from 'url';
import { defineConfig, loadEnv } from 'vite';
import { resolvePath, viteDefine, setupVitePlugins, createViteProxy } from './build';
import { viteDefine, setupVitePlugins, createViteProxy } from './build';
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as ImportMetaEnv;
const vitePath = resolvePath('./', import.meta.url);
const rootPath = fileURLToPath(new URL('./', import.meta.url));
const srcPath = `${rootPath}src`;
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'~': vitePath.root,
'@': vitePath.src
'~': rootPath,
'@': srcPath
}
},
define: viteDefine,
plugins: setupVitePlugins(configEnv, vitePath.src, viteEnv),
plugins: setupVitePlugins(viteEnv, srcPath),
css: {
preprocessorOptions: {
scss: {