-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
57 lines (52 loc) · 1.28 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
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import eslint from 'rollup-plugin-eslint';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import { version } from './package.json';
const isProduction = process.env.NODE_ENV === 'production';
const file = `dist/${ isProduction ? 'kwulers.min.js' : 'kwulers.js' }`;
const banner = `/*!
* @name Kwulers v${ version }
* @license MIT
* @copyright (c) ${ new Date().getFullYear() } Mark Rabey
* @author Mark Rabey <[email protected]> (https://markrabey.com)
*/
`;
const uglifyOptions = {
output: {
comments: function(node, comment) {
const text = comment.value;
const type = comment.type;
if (type === 'comment2') {
return /@preserve|@license|@cc_on/i.test(text);
}
}
}
};
export default {
input: 'src/kwulers.js',
output: {
file,
sourcemap: true,
format: 'umd',
exports: 'named',
name: 'kwulers',
banner
},
plugins: [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
eslint({
exclude: 'src/test/**',
}),
babel({
exclude: 'node_modules/**',
}),
(process.env.NODE_ENV === 'production' && uglify(uglifyOptions)),
],
};