-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
48 lines (42 loc) · 1.05 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
import typescript from "rollup-plugin-typescript";
import { uglify } from "rollup-plugin-uglify";
import pkg from "./package.json";
const GLOBALS = {
identitate: "identitate",
"fast-equals": "fe",
reselect: "Reselect",
unchanged: "unchanged"
};
const UMD_CONFIG = {
external: Object.keys(GLOBALS),
input: "src/index.ts",
output: {
exports: "named",
file: pkg.browser,
format: "umd",
globals: GLOBALS,
name: pkg.name,
sourcemap: true
},
plugins: [typescript()]
};
const FORMATTED_CONFIG = Object.assign({}, UMD_CONFIG, {
output: [
Object.assign({}, UMD_CONFIG.output, {
file: pkg.main,
format: "cjs"
}),
Object.assign({}, UMD_CONFIG.output, {
file: pkg.module,
format: "es"
})
]
});
const MINIFIED_CONFIG = Object.assign({}, UMD_CONFIG, {
output: Object.assign({}, UMD_CONFIG.output, {
file: pkg.browser.replace(".js", ".min.js"),
sourcemap: false
}),
plugins: UMD_CONFIG.plugins.concat([uglify()])
});
export default [UMD_CONFIG, FORMATTED_CONFIG, MINIFIED_CONFIG];