-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
45 lines (42 loc) · 1.15 KB
/
rollup.config.js
File metadata and controls
45 lines (42 loc) · 1.15 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
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import {readFileSync} from "fs";
import pluginPeerDepsExternalModule from "rollup-plugin-peer-deps-external";
import terser from "@rollup/plugin-terser";
const packageJsonURL = new URL("./package.json", import.meta.url);
const packageJson = JSON.parse(readFileSync(packageJsonURL, "utf8"));
const rollupConfiguration = [
{
input: "src/index.ts",
output: [
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
external: [],
plugins: [
commonjs({
transformMixedEsModules: true,
include: [],
}),
pluginPeerDepsExternalModule(),
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
declarationDir: "dist",
exclude: ["**/tests/", "**/*.test.ts", "**/*.test.tsx"],
}),
terser(),
],
},
{
input: "dist/esm/index.d.ts",
output: [{file: "dist/index.d.ts", format: "esm"}],
plugins: [dts()],
external: [/\.css$/],
},
];
export default rollupConfiguration;