forked from qlik-oss/enigma.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
64 lines (59 loc) · 1.72 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
// rollup.config.js
import resolve from 'rollup-plugin-node-resolve';
// import nodeGlobals from 'rollup-plugin-node-globals';
import nodeBuiltins from 'rollup-plugin-node-builtins';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import filesize from 'rollup-plugin-filesize';
import license from 'rollup-plugin-license';
import extend from 'extend';
const pkg = require('./package.json');
const createConfig = (overrides) => {
const config = {
output: {
format: 'umd',
sourcemap: true,
},
plugins: [
resolve({ jsnext: true, preferBuiltins: false }),
// nodeGlobals() is disabled right now due to a bug: https://github.com/calvinmetcalf/rollup-plugin-node-globals/issues/9
// nodeGlobals(),
nodeBuiltins(),
commonjs(),
babel({
exclude: 'node_modules/**',
plugins: ['external-helpers'],
}),
license({
banner: `
${pkg.name} v${pkg.version}
Copyright (c) ${new Date().getFullYear()} QlikTech International AB
This library is licensed under MIT - See the LICENSE file for full details
`,
}),
filesize(),
],
};
extend(true, config, overrides);
if (process.env.NODE_ENV === 'production') {
config.output.file = config.output.file.replace('.js', '.min.js');
config.plugins.push(uglify());
}
return config;
};
const enigma = createConfig({
input: 'src/qix.js',
output: {
file: 'enigma.js',
name: 'enigma',
},
});
const senseUtilities = createConfig({
input: 'src/sense-utilities.js',
output: {
file: 'sense-utilities.js',
name: 'senseUtilities',
},
});
export default [enigma, senseUtilities];