forked from react-dropzone/file-selector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
60 lines (54 loc) · 1.26 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const camelCase = require('camelcase');
const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');
const sourcemaps = require('rollup-plugin-sourcemaps');
const {uglify} = require('rollup-plugin-uglify');
const pckg = require('./package.json');
const name = pckg.name;
const input = pckg.module;
const plugins = [
resolve(),
commonjs(),
sourcemaps()
];
const output = {
format: 'umd',
name: camelCase(name),
// The key here is library name,and the value is the the name of the global variable name the window object.
// See https://github.com/rollup/rollup/wiki/JavaScript-API#globals for more.
globals: {
// TS
// 'tslib': 'tslib'
},
sourcemap: true
};
// List of dependencies
// See https://github.com/rollup/rollup/wiki/JavaScript-API#external for more.
const external = [
// TS
// 'tslib'
];
export default [{
input,
plugins,
external,
output: {
...output,
file: distPath(`${name}.umd.js`)
}
},
{
input,
plugins: [
...plugins,
uglify()
],
external,
output: {
...output,
file: distPath(`${name}.umd.min.js`)
}
}];
function distPath(file) {
return `./dist/bundles/${file}`;
}