-
Notifications
You must be signed in to change notification settings - Fork 82
/
rollup.config.js
73 lines (67 loc) · 1.9 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
65
66
67
68
69
70
71
72
73
// rollup.config.js
import resolve from 'rollup-plugin-node-resolve';
// import nodeGlobals from 'rollup-plugin-node-globals';
import nodeBuiltins from '@joseph184/rollup-plugin-node-builtins';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
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/**',
externalHelpers: true,
}),
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(terser());
}
return config;
};
const enigma = createConfig({
input: 'src/enigma.js',
output: {
file: 'enigma.js',
name: 'enigma',
},
});
const senseUtilities = createConfig({
input: 'src/sense-utilities.js',
output: {
file: 'sense-utilities.js',
name: 'senseUtilities',
},
});
const errorCodes = createConfig({
input: 'src/error-codes.js',
output: {
file: 'error-codes.js',
name: 'error-codes',
sourcemap: false,
},
});
export default [enigma, senseUtilities, errorCodes];