1 Star 0 Fork 0

bin/bin-files

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
bin 提交于 2024-07-02 10:22 . 新增部分图片,发布
import { loadEnv, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
function pathResolve(dir) {
return resolve(process.cwd(), '.', dir)
}
// https://vitejs.dev/config/
export default ({ mode }) => {
const dirRoot = process.cwd()
const env = loadEnv(mode, dirRoot)
return defineConfig({
base: process.env.NODE_ENV === 'production' ? env.VITE_PUBLIC_PATH : '',
plugins: [vue()],
server: {
host: '0.0.0.0',
port: 9090,
open: true,
},
resolve: {
alias: {
'@': pathResolve('./src'),
},
},
optimizeDeps: {
include: [
'vue',
'bin-ui-design',
],
exclude: [],
},
build: {
sourcemap: false,
outDir: 'docs',
rollupOptions: {
output: {
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: 'static/js/[name]-[hash].js',
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
manualChunks(id) {
if (id.includes('/node_modules/')) {
// 设置需要独立打包的npm包
const expansions = ['bin-ui-design']
const c = expansions.find(exp => id.includes(`/node_modules/${exp}`))
if (c) {
return `chunk-${c}`
} else {
return 'vendor'
}
}
},
},
},
// Turning off brotliSize display can slightly reduce packaging time
brotliSize: false,
chunkSizeWarningLimit: 2000,
},
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangbin3162/bin-files.git
[email protected]:wangbin3162/bin-files.git
wangbin3162
bin-files
bin-files
master

搜索帮助