-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
rollup.config.js
59 lines (51 loc) · 1.27 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
/* eslint-env node */
const path = require('path')
const babel = require('rollup-plugin-babel')
const { uglify } = require('rollup-plugin-uglify')
const pkg = require(path.resolve(__dirname, 'package.json'))
const year = new Date().getFullYear()
const buildProd = process.env.PROD === 'true'
const buildTest = process.env.TEST === 'true'
const buildDev = process.env.DEV === 'true'
const conf = {
input: './src/index.js',
output: {
banner:
`/*!
* bsCustomFileInput v${pkg.version} (${pkg.homepage})
* Copyright 2018 - ${year} ${pkg.author}
* Licensed under MIT (https://github.com/Johann-S/bs-custom-file-input/blob/master/LICENSE)
*/`,
file: './dist/bs-custom-file-input.js',
format: 'umd',
name: 'bsCustomFileInput',
sourcemap: true,
},
plugins: [
babel({
exclude: 'node_modules/**',
}),
],
}
if (buildTest) {
conf.output.file = './tests/coverage/bs-custom-file-input.js'
}
if (buildDev) {
conf.output.file = './tests/coverage/bs-custom-file-input.js'
conf.watch = {
include: 'src/**.js',
}
}
if (buildProd) {
conf.output.file = './dist/bs-custom-file-input.min.js'
conf.plugins.push(uglify({
compress: {
typeofs: false,
},
mangle: true,
output: {
comments: /^!/,
},
}))
}
module.exports = conf