forked from francoischalifour/medium-zoom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
70 lines (66 loc) · 1.56 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
import babel from 'rollup-plugin-babel'
import { terser } from 'rollup-plugin-terser'
import license from 'rollup-plugin-license'
import replace from 'rollup-plugin-replace'
import { uglify } from 'rollup-plugin-uglify'
import postcss from 'rollup-plugin-postcss'
import filesize from 'rollup-plugin-filesize'
import cssnano from 'cssnano'
import pkg from './package.json'
const banner = `/*! ${pkg.name} ${pkg.version} | ${pkg.license} License | https://github.com/${pkg.repository} */`
const sharedPlugins = [
postcss({
extensions: ['.css'],
plugins: [cssnano()],
}),
replace({
__TEST__: process.env.NODE_ENV === 'test' ? 'true' : 'false',
}),
babel({
exclude: 'node_modules/**',
plugins: ['external-helpers', 'transform-object-rest-spread'],
}),
filesize({
showMinifiedSize: false,
showGzippedSize: true,
}),
]
export default [
{
input: 'src/index.js',
output: {
file: pkg.module,
format: 'es',
},
plugins: [...sharedPlugins, license({ banner })],
},
{
input: 'src/index.js',
output: {
name: 'mediumZoom',
file: pkg.main.replace('.min', ''),
format: 'umd',
},
plugins: [
...sharedPlugins,
uglify({
compress: false,
mangle: false,
output: {
beautify: true,
indent_level: 2,
preamble: banner,
},
}),
],
},
{
input: 'src/index.js',
output: {
name: 'mediumZoom',
file: pkg.main,
format: 'umd',
},
plugins: [...sharedPlugins, terser(), license({ banner })],
},
]