-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
92 lines (89 loc) · 1.94 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import typescript from "@rollup/plugin-typescript";
import replace from "@rollup/plugin-replace";
// import afterEffectJsx from "rollup-plugin-ae-jsx";
import pkg from "./package.json";
import { terser } from "rollup-plugin-terser";
import license from "rollup-plugin-license";
import User from "./src/user.ts";
import path from "path";
import cleanup from "rollup-plugin-cleanup";
const enableTerser = true;
export default [{
input: "src/index.ts",
output: {
file: pkg.main,
format: "iife",
globals: {
this: "this",
},
externalLiveBindings: false,
interop: false, // fuck the shit `_interopDefaultLegacy`.
},
onwarn: function (warning) {
console.warn(warning.message);
},
context: "this",
external: [...Object.keys(pkg.dependencies), "this"],
plugins: [
replace({
preventAssignment: true,
values: {
_npmVersion: pkg.version,
},
}),
typescript({
module: "esnext",
target: "es5",
noImplicitAny: true,
moduleResolution: "classic",
strict: true,
}),
cleanup({
comments: "all",
lineEndings: "unix",
}),
enableTerser && terser({
compress: {
// conditionals: false, // ExtendScript 对三元运算符的运算顺序有偏见。
// comparisons: false, // ExtendScript 对逻辑与、逻辑或的运算顺序也有偏见。
defaults: false, // 直接禁用默认得了。
},
}),
license({
banner: {
content: {
file: path.join(__dirname, "banner.template.ejs"),
},
data: User,
}
}),
],
}];
/* , {
input: "src/utils.ts",
output: {
file: "dist/om_utils.jsx",
format: "cjs",
format: "es",
},
onwarn: function (warning) {
console.warn(warning.message);
},
external: Object.keys(pkg.dependencies),
plugins: [
replace({
preventAssignment: true,
values: {
_npmVersion: pkg.version,
},
}),
typescript({
module: "esnext",
target: "es5",
noImplicitAny: true,
moduleResolution: "node",
strict: true,
}),
afterEffectJsx(),
],
} */