-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrollup.config.mjs
63 lines (62 loc) · 1.63 KB
/
rollup.config.mjs
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
// import babel from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import { defineConfig } from "rollup";
import { terser } from "rollup-plugin-terser";
import ts from "rollup-plugin-ts";
import rollupExternalModules from "rollup-external-modules";
const terserplugin = terser({
compress: {
ecma: 2015,
toplevel: true,
unused: true,
drop_debugger: true,
},
module: true,
mangle: true,
output: { comments: false, beautify: true },
});
// const external = [
// "@masx200/async-task-current-limiter",
// "@masx200/mini-cli-args-parser",
// "btoa",
// "fs-extra",
// "node-fetch",
// "cookie",
// ];
const banner = `#!/usr/bin/env node`;
const external = rollupExternalModules;
export default defineConfig([
{
external: external,
input: "./lib/index.ts",
output: [
{ sourcemap: true, file: "./dist/index.js", format: "esm" },
{ sourcemap: true, file: "./dist/index.cjs", format: "cjs" },
],
plugins: [
resolve(),
commonjs(),
ts({ transpiler: "typescript" }),
terserplugin,
],
},
{
external: external,
input: "./lib/cli.ts",
output: [
{
banner,
sourcemap: true,
file: "./dist/cli.js",
format: "esm",
},
],
plugins: [
resolve(),
commonjs(),
ts({ transpiler: "typescript" }),
terserplugin,
],
},
]);