-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
48 lines (43 loc) · 1.32 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 babel from "rollup-plugin-babel";
import babelrc from "babelrc-rollup";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import replace from "rollup-plugin-replace";
import pkg from "./package.json";
import uglify from "rollup-plugin-uglify";
const BASE_CONFIG = {
input: "src/index.js",
plugins: [
replace({
"process.env.STITCH_JS_HOST": `"${process.env.STITCH_JS_HOST ||
"https://app.stitchdata.com"}"`,
"process.env.STITCH_JS_VERBOSE_OUTPUT":
process.env.STITCH_JS_VERBOSE_OUTPUT
})
]
};
const BASE_UMD_CONFIG = Object.assign({}, BASE_CONFIG, {
plugins: [...BASE_CONFIG.plugins, resolve(), commonjs(), babel(babelrc())]
});
export default [
// browser-friendly UMD build
Object.assign({}, BASE_UMD_CONFIG, {
output: [
{
file: pkg.browser,
format: "umd",
name: "Stitch"
}
]
}),
// minified browser-friendly UMD build
Object.assign({}, BASE_UMD_CONFIG, {
output: [{ file: pkg.browserMin, format: "umd", name: "Stitch" }],
plugins: [...BASE_UMD_CONFIG.plugins, uglify()]
}),
// // ES module (for bundlers) build.
Object.assign({}, BASE_CONFIG, {
external: ["core-js/library/fn/object", "core-js/library/fn/promise"],
output: [{ file: pkg.main, format: "es" }]
})
];