-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
61 lines (57 loc) · 1.51 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
import commonjs from "@rollup/plugin-commonjs";
import { defineConfig } from "rollup";
import json from "@rollup/plugin-json";
import resolve from "@rollup/plugin-node-resolve";
import rollupExternalModules from "rollup-external-modules";
import swc from "rollup-plugin-swc";
import { terser } from "rollup-plugin-terser";
const banner = `#!/usr/bin/env node`;
const terserplugin = terser({
compress: {
ecma: 2015,
toplevel: true,
unused: true,
drop_debugger: true,
},
module: true,
mangle: true,
output: { comments: false, beautify: true },
});
export default defineConfig([
{
external: rollupExternalModules,
input: "./src/webdav-cli.cli.ts",
output: [
{
banner,
sourcemap: true,
file: "./dist/webdav-cli.cli.js",
format: "esm",
},
],
plugins: [swcplugin(), resolve(), commonjs(), terserplugin, json()],
},
{
external: rollupExternalModules,
input: "./src/index.ts",
output: [
{
banner,
sourcemap: true,
file: "./dist/index.js",
format: "esm",
},
],
plugins: [swcplugin(), resolve(), commonjs(), terserplugin, json()],
},
]);
function swcplugin() {
return swc.default({
jsc: {
parser: {
syntax: "typescript",
},
target: "esnext",
},
});
}