1 Star 0 Fork 0

Tenny/neatui-vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
Tenny 提交于 2024-08-08 17:23 . Squashed commit of the following:
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
import { readdirSync } from 'node:fs';
import path from 'path';
const entries = {};
const entryFiles = readdirSync('./src', { recursive: true, encoding: 'utf-8' });
for (const filename of entryFiles) {
if (filename.startsWith('components') || filename.startsWith('directives')) {
const filepath = path.parse(filename);
if (filepath.ext === '') continue;
const fileAbsName = path.join('src', filename);
if (filepath.dir === `components${path.sep}Message`) {
if (filepath.ext === '.ts') {
entries[filepath.dir] = fileAbsName;
}
} else {
entries[path.join(filepath.dir, filepath.name)] = fileAbsName;
}
}
}
entries['index'] = 'src/index.ts';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
dts({
tsconfigPath: 'tsconfig.types.json',
}),
],
build: {
outDir: 'lib',
lib: {
entry: entries,
formats: ['es'],
fileName: (format, entryName) => {
return `${entryName}.js`;
},
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external: ['vue', 'ph-utils', 'vue-router', '@tanstack/vue-table'],
output: {
chunkFileNames: '[name]-[hash].js',
},
},
emptyOutDir: true,
copyPublicDir: false,
},
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/towardly/neatui-vue.git
[email protected]:towardly/neatui-vue.git
towardly
neatui-vue
neatui-vue
main

搜索帮助