-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
35 lines (30 loc) · 893 Bytes
/
rollup.config.js
File metadata and controls
35 lines (30 loc) · 893 Bytes
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import filesize from 'rollup-plugin-filesize';
const makeRollupConfig = (globalObjectName, inputFile, outputFile) => {
const config = {
input: inputFile,
output: {
file: outputFile,
format: 'umd',
name: globalObjectName,
sourcemap: true,
},
plugins: [
resolve(),
commonjs(),
babel({ babelHelpers: 'bundled' }),
],
};
if (outputFile.includes('.min.')) {
config.plugins.push(terser({ compress: { passes: 2 } }));
}
config.plugins.push(filesize({ showMinifiedSize: false }));
return config;
};
export default [
makeRollupConfig('Impulsion', 'src/impulsion.js', 'dist/impulsion.js'),
makeRollupConfig('Impulsion', 'src/impulsion.js', 'dist/impulsion.min.js'),
];