-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
48 lines (46 loc) · 1.22 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
const resolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
const { uglify } = require('rollup-plugin-uglify');
const fs = require('fs');
const path = require('path');
const packagesDir = path.resolve(__dirname, 'packages');
const packageFiles = fs.readdirSync(packagesDir);
function output(path) {
return [
{
input: [`./packages/${path}/src/index.js`],
output: [
{
file: `./packages/${path}/dist/index.cjs.js`,
format: 'cjs',
sourcemap: true
},
{
file: `./packages/${path}/dist/index.esm.js`,
format: 'esm',
sourcemap: true
},
{
file: `./packages/${path}/dist/index.js`,
format: 'umd',
name: 'Tmonitor',
sourcemap: true
},
{
file: `./packages/${path}/dist/index.min.js`,
format: 'umd',
name: 'Tmonitor',
sourcemap: true,
plugins: [uglify()]
}
],
plugins: [
resolve(),
commonjs(),
json()
]
}
];
}
module.exports = [...packageFiles.map(path => output(path)).flat()];