-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
45 lines (40 loc) · 991 Bytes
/
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
import typescript from "rollup-plugin-typescript";
import { terser } from "rollup-plugin-terser";
import postcss from "rollup-plugin-postcss";
import { cst } from "hel-dev-utils";
import pkg from "./package.json";
const env = process.env.BUILD_ENV || "umd";
const plugins = [
typescript({
exclude: "node_modules/**",
typescript: require("typescript"),
}),
postcss({
modules: true,
extensions: [".css", ".less"],
extract: true,
}),
];
const env2outputConf = {
es: {
format: "es",
name: pkg.appGroupName,
file: `${cst.HEL_PROXY_DIR}_es/entry.js`,
},
umd: {
format: "umd",
name: pkg.appGroupName,
file: `${cst.HEL_PROXY_DIR}/entry.js`,
},
};
const outputObj = env2outputConf[env];
if (process.env.MIN === "true") {
plugins.push(terser());
const [dirName] = outputObj.file.split("/");
outputObj.file = `${dirName}/entry.min.js`;
}
module.exports = {
input: "src/entrance/libTypes.ts",
plugins,
output: [outputObj],
};