-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.apollo.js
42 lines (39 loc) · 1.18 KB
/
rollup.apollo.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
"use strict";
const path = require("path");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const cjs = require("@rollup/plugin-commonjs");
const { babel } = require("@rollup/plugin-babel");
const { terser } = require("rollup-plugin-terser");
function buildConfig(minify) {
const config = {
input: path.resolve(__dirname, "apollo/index.js"),
output: {
ui5ModuleName: `/resources/apollo/client/thirdparty/apollo${minify ? "" : "-dbg"}.js`,
format: "amd",
amd: {
define: "sap.ui.define"
}
},
plugins: [
nodeResolve({
browser: true,
mainFields: ["module", "main"]
}),
cjs({
exclude: ["src/**", "lib/**"],
}),
babel({
babelHelpers: "bundled",
exclude: "node_modules/**"
})
]
};
if (minify) {
config.plugins.push(terser());
}
return config;
}
module.exports = [
buildConfig(),
buildConfig(true) // required as UI5 uglify task is using workspace.byGlobSource (which excludes generated resources from being minified)
];