forked from thekelvinliu/country-code-emoji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
39 lines (34 loc) · 910 Bytes
/
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
import analyzer from 'rollup-plugin-analyzer';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
const input = 'src/index.js';
const isDev = process.env.NODE_ENV === 'development';
const plugins = [
analyzer({
stdout: true,
hideDeps: true,
}),
!isDev && terser({ keep_fnames: true }),
];
// commonjs and es module builds use babel.config.js
const config = {
input,
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
plugins: plugins.concat(babel()),
};
// umd builds use embeded babel config for es5
const umdConfig = {
input,
output: {
file: pkg.browser,
format: 'umd',
name: 'flag',
sourcemap: true,
},
plugins: plugins.concat(babel({ presets: ['@babel/preset-env'] })),
};
export default [config, umdConfig];