-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
37 lines (34 loc) · 932 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
const input = './lib/index.js';
const getUmdOptions = ({ minify }) => {
return {
input,
output: {
file: `dist/react-updates${minify ? '.min.js' : '.js'}`,
format: 'umd',
name: 'ReactUpdates',
globals: { react: 'React', 'react-dom': 'ReactDOM' },
},
external: ['react', 'react-dom'],
plugins: [resolve(), commonjs(), minify ? terser() : null],
};
};
export default [
getUmdOptions({ minify: false }),
getUmdOptions({ minify: true }),
{
input,
output: { file: pkg.main, format: 'cjs', preferConst: true },
external: /^(?![./])/,
plugins: [resolve()],
},
{
input,
output: { file: pkg.module, format: 'esm' },
external: /^(?![./])/,
plugins: [resolve()],
},
];