-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
39 lines (38 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
const commonjs = require('@rollup/plugin-commonjs')
const { terser } = require('rollup-plugin-terser')
const { author, license, version, name } = require('./package.json')
// can i mix import?
// replace export for better rollup
const camelizedName = name.replace(/-(\w)/g, (_, char) => char ? char.toUpperCase() : '')
const licenseText = "/* " + name + ".js - copyright " + author + ". " + license + " license. Version " + version + ". */"
module.exports = {
input: 'src/index.js',
output: [
{
format: 'umd',
name: camelizedName,
file: "dist/"+name+".js",
banner: licenseText
},
{
format: 'umd',
name: camelizedName,
file: 'dist/'+name+'.min.js',
banner: licenseText,
plugins: [
terser({
format: {
comments: function(node, comment) {
var isMultiline = comment.type === "comment2"
if (isMultiline)
return /MIT license/.test(comment.value)
}
}
})
]
}
],
plugins: [
commonjs()
]
}