forked from Donaldcwl/browser-image-compression
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
46 lines (43 loc) · 1.05 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
import babel from 'rollup-plugin-babel'
import { terser } from 'rollup-plugin-terser'
import nodent from 'rollup-plugin-nodent'
import license from 'rollup-plugin-license'
import copy from 'rollup-plugin-copy'
import path from 'path'
const pkg = require('./package.json')
const external = Object.keys(pkg.dependencies)
let plugins = [
nodent({ noRuntime: true, promises: true }),
babel(),
terser({
keep_fnames: true,
mangle: { reserved: ['CustomFile', 'CustomFileReader'] }
}),
license({
sourcemap: true,
banner: '<%= _.startCase(pkg.name) %>\nv<%= pkg.version %>\nby <%= pkg.author %>\n<%= pkg.repository.url %>',
}),
copy({
targets: [
{ src: 'lib/index.d.ts', dest: path.dirname(pkg.types) , rename: path.basename(pkg.types) }
]
})
]
export default {
input: 'lib/index.js',
plugins: plugins,
external: external,
output: [
{
file: pkg.main,
name: 'imageCompression',
format: 'umd',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
]
}