1 Star 0 Fork 0

Running/ele-admin-pro-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.js 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
john 提交于 2024-07-02 16:21 . first commit
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import ViteCompression from 'vite-plugin-compression';
import ViteComponents from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import { EleAdminResolver } from 'ele-admin-pro/lib/utils/resolvers';
import { DynamicAntdLess } from 'ele-admin-pro/lib/utils/dynamic-theme';
import { resolve } from 'path';
export default defineConfig(({ command }) => {
const isBuild = command === 'build';
return {
resolve: {
alias: {
'@/': resolve('src') + '/',
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
}
},
plugins: [
vue(),
// 组件按需引入
ViteComponents({
dts: false,
resolvers: [
AntDesignVueResolver({
importStyle: isBuild ? 'less' : false
}),
EleAdminResolver({
importStyle: isBuild ? 'less' : false
})
]
}),
// gzip 压缩
ViteCompression({
disable: !isBuild,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz'
})
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
plugins: [new DynamicAntdLess()],
modifyVars: {
// 组件样式开发环境全局引入生产环境按需引入
'style-entry-file': isBuild ? 'as-needed' : 'global-import'
}
}
}
},
optimizeDeps: {
include: [
'sortablejs',
'vuedraggable',
'echarts/core',
'echarts/charts',
'echarts/renderers',
'echarts/components',
'vue-echarts',
'echarts-wordcloud',
'xlsx'
]
},
build: {
target: 'chrome63',
chunkSizeWarningLimit: 2000
}
};
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhujinrun/ele-admin-pro-js.git
git@gitee.com:zhujinrun/ele-admin-pro-js.git
zhujinrun
ele-admin-pro-js
ele-admin-pro-js
master

搜索帮助