-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
56 lines (52 loc) · 1.16 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
const json = require("rollup-plugin-json");
const commonjs = require("rollup-plugin-commonjs");
const resolve = require("rollup-plugin-node-resolve");
const babel = require("rollup-plugin-babel");
const nodeBuiltIns = require("rollup-plugin-node-builtins");
const nodeGlobals = require("rollup-plugin-node-globals");
const uglifier = require("rollup-plugin-uglify");
const BASE_PLUGINS = [
resolve({
module: true,
main: true,
browser: true,
jsnext: true,
preferBuiltins: true
}),
commonjs({
include: "node_modules/**"
}),
json(),
babel(),
nodeBuiltIns(),
nodeGlobals()
];
const BASE_CONFIG = {
input: "src/index.js",
external: ["@xbyorange/mercury", "lodash"],
plugins: [...BASE_PLUGINS, uglifier.uglify()]
};
const GLOBALS = {
"@xbyorange/mercury": "mercury",
lodash: "lodash"
};
module.exports = [
{
...BASE_CONFIG,
output: {
file: "dist/mercury-memory.umd.js",
format: "umd",
name: "mercury-memory",
globals: GLOBALS
}
},
{
...BASE_CONFIG,
output: {
file: "dist/mercury-memory.esm.js",
format: "esm",
globals: GLOBALS
},
plugins: BASE_PLUGINS
}
];