-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
82 lines (73 loc) · 1.78 KB
/
rollup.config.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
const fs = require('fs');
const join = require('path').join;
/**
// *
// * @param startPath
// * @returns {Array}
// */
// function findSync(startPath = './src') {
// const entryList = {};
// const files = fs.readdirSync(startPath);
// files.forEach(val => {
// const fPath = join(startPath, val);
// const stats = fs.statSync(fPath);
// // if (stats.isDirectory()) findSync(fPath);
// if (stats.isFile()) {
// const match = fPath.match(/src\/(\S*)(.ts|.js)/);
// const name = match[1];
// entryList[name] = `./src/${name}.${match[2] === '.js' ? 'js' : 'ts'}`;
// }
// });
// return entryList;
// }
const configList = [];
// const fileDict = findSync();
// for (const fileName in fileDict) {
// configList.push({
// input: fileDict[fileName],
// output: {
// dir: 'lib',
// format: 'umd',
// name: fileName,
// },
// plugins: [
// resolve(),
// typescript(),
// commonjs({
// extensions: ['.js', '.ts'],
// }),
// babel({
// babelHelpers: 'bundled',
// exclude: 'node_modules/**',
// extensions: ['.ts'],
// }),
// terser(),
// ]
// });
// }
configList.push({
input: './src/index.ts',
output: {
dir: 'dist/es',
format: 'es',
},
plugins: [
resolve(),
typescript(),
commonjs({
extensions: ['.js', '.ts'],
}),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.ts'],
}),
terser(),
]
});
export default configList;