-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
35 lines (30 loc) · 991 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
import { readFileSync } from 'fs';
import buble from 'rollup-plugin-buble';
import uglify from 'rollup-plugin-uglify';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
const pkg = JSON.parse( readFileSync( 'package.json', 'utf-8' ) );
const isProduction = process.env.NODE_ENV === 'production';
const banner = readFileSync( 'banner.js', 'utf-8' )
.replace( '${name}', pkg.name )
.replace( '${version}', pkg.version )
.replace( '${author}', pkg.author )
.replace( '${homepage}', pkg.homepage )
export default {
input: `./lib/index.js`,
plugins: [
isProduction ? uglify({}) : {},
commonjs({ include: './node_modules/**' }),
buble({exclude: './node_modules/**'}),
replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) })
],
banner: banner,
sourceMap: false,
name: pkg.name,
output: [
{
file: `./dist/${pkg.name}.${isProduction ? 'min.js' : 'js'}`,
format: 'umd'
}
]
};