-
Notifications
You must be signed in to change notification settings - Fork 47
/
rollup.config.js
36 lines (30 loc) · 900 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
import babel from 'rollup-plugin-babel';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import Visualizer from 'rollup-plugin-visualizer';
const entries = {
min: 'lib/index.js',
umd: 'lib/index.js',
};
const dests = {
min: 'dist/logger.min.js',
umd: 'dist/logger.js',
}
const { NODE_ENV = 'umd' } = process.env;
export const input = entries[NODE_ENV];
export const context = 'this';
export const external = ['diffhtml'];
export const output = [{
file: dests[NODE_ENV],
format: 'umd',
exports: 'default',
name: 'logger',
sourcemap: false,
globals: { diffhtml: 'diff' },
}];
export const plugins = [
NODE_ENV === 'min' && replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
babel(),
nodeResolve({ mainFields: ['module'] }),
NODE_ENV === 'umd' && Visualizer({ filename: './dist/build-size.html' }),
];