forked from lucide-icons/lucide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.plugins.js
39 lines (37 loc) · 1.15 KB
/
rollup.plugins.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
/* eslint-disable import/no-extraneous-dependencies */
import babel from '@rollup/plugin-babel';
import bundleSize from '@atomico/rollup-plugin-sizes';
import compiler from '@ampproject/rollup-plugin-closure-compiler';
import { terser } from 'rollup-plugin-terser';
import visualizer from 'rollup-plugin-visualizer';
import license from 'rollup-plugin-license';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import commonJS from '@rollup/plugin-commonjs';
const plugins = (pkg, minify) =>
[
replace({
'icons = {}': 'icons = allIcons',
delimiters: ['', ''],
preventAssignment: false,
}),
babel({
babelHelpers: 'bundled',
}),
// The two minifiers together seem to procude a smaller bundle 🤷♂️
minify && compiler(),
minify && terser(),
license({
banner: `${pkg.name} v${pkg.version} - ${pkg.license}`,
}),
bundleSize(),
resolve(),
commonJS({
include: 'node_modules/**',
}),
visualizer({
sourcemap: true,
filename: `stats/${pkg.name}${minify ? '-min' : ''}.html`,
}),
].filter(Boolean);
export default plugins;