-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
42 lines (37 loc) · 973 Bytes
/
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
import babel from 'rollup-plugin-babel'
import nodeResolve from '@rollup/plugin-node-resolve'
import rollupPrettier from 'rollup-plugin-prettier'
import {terser} from 'rollup-plugin-terser'
import prettier from 'prettier'
const libraryName = 'PromisifyFile'
const prettierConfig = prettier.resolveConfig.sync('src/index.js')
const plugins = [nodeResolve(), babel(), rollupPrettier(prettierConfig)]
const minify = [nodeResolve(), babel(), terser()]
const builds = {
input: 'src/index.js',
output: [
// umd build
{
file: 'lib/index.js',
format: 'umd',
name: libraryName,
sourcemap: true,
},
// esm build
{
file: 'lib/index.mjs',
format: 'esm',
sourcemap: true,
},
],
plugins,
}
const minifiedBuilds = {
...builds,
output: builds.output.map((config) => ({
...config,
file: config.file.replace(/(\.m?js)$/, '.min$1'),
})),
plugins: minify,
}
export default [builds, minifiedBuilds]