-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrollup.config.js
More file actions
35 lines (28 loc) · 809 Bytes
/
rollup.config.js
File metadata and controls
35 lines (28 loc) · 809 Bytes
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
const {rollup} = require('rollup');
const babel = require('rollup-plugin-babel');
const {terser} = require('rollup-plugin-terser');
const inputOptions = {
input: 'index.js',
plugins: [
babel({
babelrc: false,
presets: [['@babel/preset-env', {modules: false}]]
})
]
};
const outputOptions = {
name: 'colorConvert',
format: 'umd'
};
async function build() {
// normal file
outputOptions.file = outputOptions.name + '.js';
const normalBundle = await rollup(inputOptions);
await normalBundle.write(outputOptions);
// min file
inputOptions.plugins.push(terser());
outputOptions.file = outputOptions.name + '.min.js';
const minBundle = await rollup(inputOptions);
await minBundle.write(outputOptions);
}
build();