forked from crcn/sift.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
54 lines (52 loc) · 1.17 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
50
51
52
53
54
import ts from "@rollup/plugin-typescript";
import replace from "@rollup/plugin-replace";
import { terser } from "rollup-plugin-terser";
const config = options => {
const extraOutput = options.file
? { file: options.file }
: { dir: options.dir || options.format };
return {
input: "src/index.ts",
output: {
sourcemap: true,
...extraOutput,
format: options.format,
name: options.name,
plugins: options.outputPlugins,
exports: "named"
},
plugins: [
ts({
declaration: false,
module: "es2015",
target: options.target || "es5"
}),
...(options.plugins || [])
]
};
};
export default [
config({ format: "es", target: "es6" }),
config({ format: "es", dir: "es5m" }),
config({ format: "umd", name: "sift", dir: "lib" }),
config({
format: "umd",
name: "sift",
file: "sift.min.js",
outputPlugins: [
terser({
mangle: {
properties: {
regex: /^_\w/
}
}
})
]
}),
config({
format: "umd",
name: "sift",
file: "sift.csp.min.js",
plugins: [replace({ "process.env.CSP_ENABLED": "true" })]
})
];