加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.build.disperse.ts 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
eiinu 提交于 2023-11-20 10:29 . fix(build): locale/lang not found
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import configPkg from './src/config.json';
let input = {};
configPkg.nav.map((item) => {
item.packages.forEach((element) => {
let { name, type, exclude } = element;
if (exclude != true) {
input[name] = `./src/packages/__VUE/${name.toLowerCase()}/index${type === 'methods' ? '.ts' : '.vue'}`;
}
});
});
export default defineConfig({
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, './src') }]
},
plugins: [vue()],
build: {
minify: false,
target: 'es2015',
lib: {
entry: '',
name: 'index',
// fileName: (format) => format,
formats: ['es']
},
rollupOptions: {
// 请确保外部化那些你的库中不需要的依赖
external: ['vue', 'vue-router', '@/packages/locale', '@nutui/icons-vue'],
input,
output: {
paths: {
'@/packages/locale': '@nutui/nutui/dist/packages/locale/lang'
},
dir: path.resolve(__dirname, './dist/packages'),
entryFileNames: (chunkInfo) => `${chunkInfo.name.toLowerCase()}/${chunkInfo.name}.js`,
plugins: []
}
},
emptyOutDir: false
}
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化