2024-05-28 10:22:20 +08:00
|
|
|
import { resolve } from 'path';
|
2024-05-28 13:06:49 +08:00
|
|
|
import { ConfigEnv, UserConfigExport } from 'vite';
|
2024-05-28 10:22:20 +08:00
|
|
|
import { getPluginsList } from './build/plugins';
|
2024-05-28 13:06:49 +08:00
|
|
|
import { buildEnvironment } from './build/buildEnv';
|
2024-05-28 10:22:20 +08:00
|
|
|
import { serverOptions } from './build/server';
|
2024-05-28 13:06:49 +08:00
|
|
|
import { exclude, include } from './build/optimize';
|
2024-05-28 10:33:08 +08:00
|
|
|
import { pathResolve } from './build/utils.ts';
|
2024-05-08 13:43:24 +08:00
|
|
|
|
2024-05-28 13:06:49 +08:00
|
|
|
export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|
|
|
// const { VITE_APP_URL } = wrapperEnv(loadEnv(mode, root));
|
|
|
|
|
|
|
|
return {
|
2024-05-28 10:22:20 +08:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': resolve(__dirname, './src'),
|
|
|
|
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
|
2024-05-28 10:33:08 +08:00
|
|
|
'@build': pathResolve(),
|
2024-05-28 10:22:20 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
optimizeDeps: { include, exclude },
|
|
|
|
server: serverOptions(),
|
|
|
|
plugins: getPluginsList(),
|
|
|
|
esbuild: {
|
|
|
|
pure: ['console.log', 'debugger'],
|
|
|
|
jsxFactory: 'h',
|
|
|
|
jsxFragment: 'Fragment',
|
|
|
|
jsxInject: "import { h } from 'vue';",
|
|
|
|
},
|
|
|
|
// 配置构建过程的选项,例如是否生成压缩文件和源映射
|
|
|
|
build: buildEnvironment(),
|
2024-05-28 13:06:49 +08:00
|
|
|
};
|
|
|
|
};
|