forked from FriedRiceNoodles/banana-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.dev.mjs
40 lines (38 loc) · 971 Bytes
/
rollup.config.dev.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import fs from 'fs';
import runTSC from './scripts/rollup-plugin-copy-types.js'
const componentNames = fs
// 获取所有文件夹及文件
.readdirSync('./src', { withFileTypes: true })
// 筛选出所有文件夹
.filter((p) => p.isDirectory())
// 数据预处理
.map((p) => ({
path: `${p.name}/index`,
name: p.name,
}))
// 带上package/src/index.ts
.concat({ path: 'index', name: 'index' });
export default [
{
input: componentNames.reduce((result, p) => {
result[p.path] = `./src/${p.name}`;
return result;
}, {}),
output: {
dir: 'dist',
format: 'es',
entryFileNames: '[name].js',
},
plugins: [
typescript(),
nodeResolve({
extensions: ['.ts', '.js'],
}),
commonjs(),
runTSC(),
],
},
];