This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
61 lines (59 loc) · 1.53 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
/* eslint-env node */
const { dirname } = require("path");
const babel = require("rollup-plugin-babel");
const del = require("rollup-plugin-delete");
const { default: multiInput } = require("rollup-plugin-multi-input");
const resolve = require("rollup-plugin-node-resolve");
const progress = require("rollup-plugin-progress");
const typescript = require("rollup-plugin-typescript2");
const pkg = require("./package.json");
const tsconfig = require("./tsconfig.json");
module.exports = [
{
input: ["src/**/*.ts?(x)", "!**/__*__/**/*", "!**/*.(spec|test).*"],
output: [
{
dir: dirname(pkg.main),
format: "cjs",
},
{
dir: dirname(pkg.module),
format: "es",
},
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
multiInput(),
del({
targets: [dirname(pkg.main), dirname(pkg.module)],
verbose: true,
}),
progress({
clearLine: false,
}),
resolve(),
typescript({
typescript: require("typescript"),
useTsconfigDeclarationDir: true,
tsconfigOverride: {
compilerOptions: {
declarationDir: dirname(pkg.types),
},
exclude: [
...tsconfig.exclude,
"**/__*__/**/*",
"**/*.spec.*",
"**/*.test.*",
],
},
}),
babel({
extensions: [".ts", ".tsx"],
exclude: "**/node_modules/**/*",
}),
],
},
];