-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.js
48 lines (45 loc) · 1.17 KB
/
rollup.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 rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const resolve = require('rollup-plugin-node-resolve')
const minify = require('uglify-js-harmony')
const terser = require('rollup-plugin-terser').terser
let pkg = require('./package.json')
const attribution =
`/*!
* ${ pkg.name } ${ pkg.version } - ${ pkg.description }
*
* @author ${ pkg.author }
* @homepage ${ pkg.homepage }
* @copyright Copyright (c) ${ new Date().getFullYear() } ${ pkg.author }
* @license ${ pkg.license }
* @version ${ pkg.version }
*/
`
rollup.rollup({
input: 'src/spritz.js',
plugins: [
babel(),
resolve(),
terser({
output: {
comments: (node, comment) => {
return (comment.type === 'comment2' && /@license/i.test(comment.value))
}
}
}, minify)
]
}).then((bundle) => {
bundle.write({
file: pkg.main,
format: 'umd',
name: 'Spritz',
banner: attribution,
sourcemap: true
})
bundle.write({
file: pkg.module,
format: 'esm',
banner: attribution,
sourcemap: true
})
})