1 Star 2 Fork 1

NeegixOpensourceGroup/nebula-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
kushu001 提交于 2024-04-17 19:13 +08:00 . [feat] 实现分包编译
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 导入path
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
// 配置路径别名, @就代表当前项目的绝对路径
// __dirname是一个全局变量,表示当前模块所属目录的绝对路径
// path.resolve返回一个以相对于当前的工作目录(working directory)的绝对路径,
// 比如当前工作目录为 D:\205\wms-web 那么 @ 就代表 D:\205\wms-web\src
alias: {
'@': path.resolve(__dirname, './src'),
},
// 自定义扩展名
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
build: {
rollupOptions: {
output: {
// 分包
manualChunks(id) {
if (id.includes('node_modules')) {
return id.toString().split('node_modules/')[1].split('/')[0].toString()
}
}
}
},
chunkSizeWarningLimit: 1500 // 分包文件超过1500kb会报警告
},
server: {
port: 8080,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/neegix-opensource-group/nebula-web.git
git@gitee.com:neegix-opensource-group/nebula-web.git
neegix-opensource-group
nebula-web
nebula-web
main

搜索帮助