-
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathrollup.config.js
More file actions
52 lines (49 loc) · 1.29 KB
/
rollup.config.js
File metadata and controls
52 lines (49 loc) · 1.29 KB
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
import fs from "fs";
import path from "path";
import dts from "rollup-plugin-dts";
import typescript from "@rollup/plugin-typescript";
const pluginsRoot = "src/plugins";
function listPlugins() {
const root = path.resolve(pluginsRoot);
return fs
.readdirSync(root)
.filter(
(file) =>
fs.statSync(path.resolve(root, file)).isDirectory() && fs.existsSync(path.resolve(root, file, "index.ts")),
);
}
export default [
[
typescript({
noEmitOnError: true,
include: ["src/**/*"],
compilerOptions: {
removeComments: true,
// Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0
// Remove this after migration off "moduleResolution": "node"
ignoreDeprecations: "6.0",
},
}),
],
[dts()],
].map((plugins) => ({
input: {
index: "src/index.ts",
types: "src/types.ts",
"plugins/index": `${pluginsRoot}/index.ts`,
...Object.fromEntries(
listPlugins().map((plugin) => [`plugins/${plugin}/index`, `${pluginsRoot}/${plugin}/index.ts`]),
),
},
output: [
{
dir: "dist",
format: "esm",
minifyInternalExports: false,
},
],
external: ["react", "react-dom"],
preserveEntrySignatures: "allow-extension",
treeshake: false,
plugins,
}));