This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
rollup.config.js
62 lines (57 loc) · 1.63 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
// 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 }),
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(uglify());
}
return config;
};
const halyard = createConfig({
input: 'src/halyard.js',
output: {
file: 'dist/halyard.js',
name: 'halyard',
},
});
const halyardEnigmaMixins = createConfig({
input: 'src/enigma-mixin/halyard-enigma-mixin.js',
output: {
file: 'dist/halyard-enigma-mixin.js',
name: 'halyard-enigma-mixin',
},
});
export default [halyard, halyardEnigmaMixins];