-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrollup.config.js
44 lines (40 loc) · 1.08 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
import path from "path";
import ts from "rollup-plugin-typescript2";
import cjs from "@rollup/plugin-commonjs";
import { babel } from "@rollup/plugin-babel";
import { terser } from "rollup-plugin-terser";
const packagePath = path.resolve(__dirname, "./packages");
const distPath = path.resolve(__dirname, "./dist");
function resolvePackagePath(packageName, isDist) {
return isDist
? `${distPath}/${packageName}`
: `${packagePath}/${packageName}`;
}
const inputPath = resolvePackagePath("");
const outputPath = resolvePackagePath("", true);
export default {
input: `${inputPath}index.ts`,
output: {
file: `${outputPath}index.js`,
name: "Adaptor",
format: "umd",
exports: "named",
},
plugins: [
ts({
tsconfig: "tsconfig.rollup.json",
}),
babel({
exclude: "node_modules/**",
extensions: [".js", ".ts"],
babelHelpers: "runtime",
presets: [
["@babel/preset-env", { targets: "defaults" }],
"@babel/preset-typescript",
],
plugins: ["@babel/plugin-transform-runtime"],
}),
cjs(),
terser(),
],
};