forked from tjek/tjek-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
100 lines (97 loc) · 2.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import coffeescript from "rollup-plugin-coffee-script";
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import uglify from "rollup-plugin-uglify";
import filesize from "rollup-plugin-filesize";
import path from "path";
import { minify } from "uglify-es";
import babel from "rollup-plugin-babel";
var inputs = {
// Long term we want to get rid of the separate entry points and
// instead have one entry point that behaves properly according to environment.
node: path.join(__dirname, "lib", "coffeescript", "node.coffee"),
browser: path.join(__dirname, "lib", "coffeescript", "browser.coffee"),
};
var outputs = {
// Exclusive bundles(external `require`s untouched), for node, webpack etc.
jsCJS: path.join(__dirname, "dist", "sgn-sdk.cjs.js"), // CommonJS
jsES: path.join(__dirname, "dist", "sgn-sdk.es.js"), // ES Module
// Inclusive bundles(external `require`s resolved), for browsers etc.
jsBrowser: path.join(__dirname, "dist", "sgn-sdk.js"),
jsBrowserMin: path.join(__dirname, "dist", "sgn-sdk.min.js"),
};
export default [
{
input: inputs.node,
output: {
file: outputs.jsCJS,
format: "cjs"
},
plugins: [
coffeescript(),
commonjs({
extensions: [".js", ".coffee"]
}),
babel()
]
},
{
input: inputs.node,
output: {
file: outputs.jsES,
format: "es"
},
plugins: [
coffeescript(),
commonjs({
extensions: [".js", ".coffee"]
}),
babel()
]
},
{
input: inputs.browser,
output: {
file: outputs.jsBrowser,
format: "umd",
name: "SGN"
},
plugins: [
coffeescript(),
resolve({
jsnext: true,
main: true,
browser: true,
preferBuiltins: false
}),
commonjs({
extensions: [".js", ".coffee"]
}),
babel(),
filesize(),
]
},
{
input: inputs.browser,
output: {
file: outputs.jsBrowserMin,
format: "umd",
name: "SGN"
},
plugins: [
coffeescript(),
resolve({
jsnext: true,
main: true,
browser: true,
preferBuiltins: false
}),
commonjs({
extensions: [".js", ".coffee"]
}),
babel(),
uglify({}, minify),
filesize(),
]
}
];