10 Star 0 Fork 2

zhaoziteng/zztlj-insulated-team2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.js 2.79 KB
一键复制 编辑 原始数据 按行查看 历史
zhaoziteng 提交于 2023-04-07 08:09 . 2023-4-7早上
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import legacy from '@vitejs/plugin-legacy';
import ViteCompression from 'vite-plugin-compression';
import ViteComponents from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import { EleAdminResolver, styleDeps } from 'ele-admin-pro/lib/utils/resolvers';
import { DynamicAntdLess } from 'ele-admin-pro/lib/utils/dynamic-theme';
import { resolve } from 'path';
export default defineConfig(({ mode, command }) => {
const isBuild = command === 'build';
const env = loadEnv(mode, process.cwd());
return {
// 在这里增加 base 写子路径,注意这里前后都要有斜杠
base: '/',
server: {
host: '0.0.0.0',
port: 8000,
proxy: {
// '/api': {
// target: env.VITE_API_URL,
// // target: "http://localhost:3030",
// changeOrigin: true,
// ws: true,
// rewrite: path => path.replace(/^\/api/, '')
// }
// '/api/feathers': {
// target: "http://localhost:3030",
// changeOrigin: true,
// ws: true,
// rewrite: path => path.replace(/^\/api\/feathers/, '')
// },
'/api': {
target: env.VITE_API_URL,
// target: "http://localhost:3030",
changeOrigin: true,
ws: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
},
resolve: {
alias: {
'@/': resolve(__dirname, 'src') + '/',
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
}
},
plugins: [
vue(),
// 组件按需引入
ViteComponents({
dts: false,
resolvers: [
AntDesignVueResolver({
importStyle: 'less'
}),
EleAdminResolver({
importStyle: true
})
]
}),
// gzip 压缩
ViteCompression({
disable: !isBuild,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz'
}),
// 兼容低版本浏览器
legacy({
targets: ['Chrome 63'],
modernPolyfills: true
})
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
plugins: [new DynamicAntdLess()]
}
}
},
optimizeDeps: {
include: [
...styleDeps,
'ant-design-vue',
'ant-design-vue/es',
'ele-admin-pro',
'ele-admin-pro/es',
'@ant-design/icons-vue',
'vuedraggable',
'dayjs',
'echarts/core',
'echarts/charts',
'echarts/renderers',
'echarts/components',
'vue-echarts',
'echarts-wordcloud',
'xlsx'
]
},
build: {
target: 'chrome63'
}
};
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/transcript/zztlj-insulated-team2.git
[email protected]:transcript/zztlj-insulated-team2.git
transcript
zztlj-insulated-team2
zztlj-insulated-team2
master

搜索帮助