2 Star 0 Fork 0

喻帅 / 智风控

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.ts 3.84 KB
一键复制 编辑 原始数据 按行查看 历史
喻帅 提交于 2022-09-14 18:01 . feat: 修改了验证bug
import { resolve } from 'path';
import { ConfigEnv, UserConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import { wrapperEnv } from './build/utils';
import pkg from './package.json';
process.env.VITE_APP_VERSION = pkg.version;
if (process.env.NODE_ENV === 'production') {
process.env.VITE_APP_BUILD_EPOCH = new Date().getTime().toString();
}
export default ({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd();
const env = loadEnv(mode, root);
// The boolean type read by loadEnv is a string. This function can be converted to boolean type
const viteEnv = wrapperEnv(env);
const { VITE_PUBLIC_PATH, VITE_DROP_CONSOLE, VITE_PORT } = viteEnv;
// const isBuild = command === 'build';
return {
base: VITE_PUBLIC_PATH,
root,
server: {
// Listening on all local IPs
host: true,
port: VITE_PORT,
// Load proxy configuration from .env
// proxy: createProxy(VITE_PROXY),
proxy: {
'/api': {
// target: 'http://106.13.210.87:9999', //服务器地址
target: 'http://10.8.21.169:9999', //电脑上地址
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''),
},
// '/post': {
// target: 'http://10.8.21.173:8080',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/post/, '/post'),
// },
},
},
plugins: [
vue(),
AutoImport({
imports: [
'vue',
'vue-router',
'@vueuse/head',
'pinia',
{
'@/store': ['useStore'],
},
],
dts: 'src/auto-imports.d.ts',
eslintrc: {
enabled: true,
},
}),
Components({
dirs: ['src/components'],
extensions: ['vue'],
// 配置antd懒加载
resolvers: [AntDesignVueResolver()],
}),
],
esbuild: {
pure: VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : [],
},
build: {
target: 'es2015',
cssTarget: 'chrome80',
outDir: 'dist',
// minify: 'terser',
/**
* 当 minify=“minify:'terser'” 解开注释
* Uncomment when minify="minify:'terser'"
*/
// terserOptions: {
// compress: {
// keep_infinity: true,
// drop_console: VITE_DROP_CONSOLE,
// },
// },
// Turning off brotliSize display can slightly reduce packaging time
brotliSize: false,
chunkSizeWarningLimit: 2000,
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'#': resolve(__dirname, './type'),
},
},
};
};
// export default defineConfig({
// })
// import { resolve } from 'path';
// import { defineConfig } from 'vite';
// import vue from '@vitejs/plugin-vue';
// import AutoImport from 'unplugin-auto-import/vite';
// import Components from 'unplugin-vue-components/vite';
// import pkg from './package.json';
// process.env.VITE_APP_VERSION = pkg.version;
// if (process.env.NODE_ENV === 'production') {
// process.env.VITE_APP_BUILD_EPOCH = new Date().getTime().toString();
// }
// export default defineConfig({
// plugins: [
// vue(),
// AutoImport({
// imports: [
// 'vue',
// 'vue-router',
// '@vueuse/head',
// 'pinia',
// {
// '@/store': ['useStore'],
// },
// ],
// dts: 'src/auto-imports.d.ts',
// eslintrc: {
// enabled: true,
// },
// }),
// Components({
// dirs: ['src/components'],
// extensions: ['vue'],
// }),
// ],
// resolve: {
// alias: {
// '@': resolve(__dirname, './src'),
// },
// },
// });
JavaScript
1
https://gitee.com/yu20010501/client-develop.git
git@gitee.com:yu20010501/client-develop.git
yu20010501
client-develop
智风控
ys_20220719

搜索帮助

53164aa7 5694891 3bd8fe86 5694891