5 Star 45 Fork 19

cyl/webman大屏可视化后台管理

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
cyl 提交于 2022-01-12 00:36 . 1.0.0
import vue from '@vitejs/plugin-vue';
import {defineConfig} from 'vite';
import AutoImport from 'unplugin-auto-import/vite';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import {resolve} from 'path';
import {loadEnv} from './src/utils/viteBuild';
const pathResolve = (dir) => {
return resolve(__dirname, '.', dir);
};
const {VITE_PORT, VITE_OPEN, VITE_PUBLIC_PATH} = loadEnv();
const alias = {
'@': pathResolve('./src/'),
'@assets': pathResolve('./src/assets/'),
};
const viteConfig = {
plugins: [
vue(),
vueSetupExtend(),
AutoImport({
imports: ['vue', 'vue-router', 'vuex'],
}),
],
root: process.cwd(),
resolve: {alias},
base: process.env.NODE_ENV === 'production' ? VITE_PUBLIC_PATH : './',
server: {
host: '0.0.0.0',
port: VITE_PORT,
open: VITE_OPEN
},
optimizeDeps: {
include: [
'axios',
'vue',
'vue-router',
'vuex',
'dayjs',
'echarts',
'bin-ui-next',
'js-cookie',
'brace',
],
exclude: [],
},
build: {
outDir: 'dist',
minify: 'esbuild',
sourcemap: false,
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
entryFileNames: `assets/[name].${new Date().getTime()}.js`,
chunkFileNames: `assets/[name].${new Date().getTime()}.js`,
assetFileNames: `assets/[name].${new Date().getTime()}.[ext]`,
manualChunks(id) {
if (id.includes('/node_modules/')) {
// 设置需要独立打包的npm包
const expansions = ['bin-ui-next', 'brace']
const c = expansions.find(exp => id.includes(`/node_modules/${exp}`))
if (c) {
return `chunk-${c}`
} else {
return 'vendor'
}
}
},
},
},
},
css: {
postcss: {
plugins: [
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
},
},
},
],
},
},
};
export default defineConfig(viteConfig);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/303711888/screen-bi.git
git@gitee.com:303711888/screen-bi.git
303711888
screen-bi
webman大屏可视化后台管理
master

搜索帮助