-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (42 loc) · 1012 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
import typescriptPlugin from "@rollup/plugin-typescript"
import typescript from "typescript"
import { terser } from "rollup-plugin-terser"
const pkg = require("./package.json")
export default {
input: "src/index.ts",
output: [
["es", false],
["es", true],
["umd", false],
["umd", true],
].map(([format, compress]) => ({
format: format,
entryFileNames: "[name].[format]" + (compress ? ".min" : "") + ".js",
sourcemap: true,
dir: "dist",
name: pkg.umdGlobal,
exports: "named",
plugins: compress
? [
terser({
compress: {
passes: 3,
unsafe: true,
ecma: 7,
},
toplevel: true,
mangle: {
properties: { regex: /^_/ },
},
}),
]
: [],
})),
external: Object.keys(pkg.dependencies || {}),
plugins: [typescriptPlugin({ typescript })].filter((x) => x),
onwarn: function (warning, warn) {
if ("THIS_IS_UNDEFINED" === warning.code) return
// if ('CIRCULAR_DEPENDENCY' === warning.code) return
warn(warning)
},
}