-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
49 lines (44 loc) · 1 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
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript2";
import getBanner from "../../scripts/banner.js";
import pkg from "./package.json" assert { type: 'json' };
console.info("Build @metablock/core");
const banner = getBanner(pkg);
const globals = { tslib: "tslib" };
const external = ["tslib"];
console.log(banner);
const config = (prod) => {
const plugins = [
typescript({
typescript: require("typescript"),
}),
];
if (prod) plugins.push(terser({ output: { preamble: banner } }));
return {
input: "src/index.ts",
output: [
{
file: pkg.module,
format: "es",
generatedCode: "es2015",
sourcemap: true,
banner,
globals,
},
{
file: pkg.main,
format: "cjs",
generatedCode: "es2015",
sourcemap: true,
banner,
globals,
},
],
external,
plugins,
watch: {
clearScreen: false,
},
};
};
export default config();