-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.js
63 lines (61 loc) · 1.3 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
import typescript from "rollup-plugin-typescript2";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";
const dev = process.env.ROLLUP_WATCH;
export default [
// Library build configuration
{
input: "src/index.ts",
output: [
{
file: "dist/index.js",
format: "cjs",
},
{
file: "dist/index.esm.js",
format: "es",
},
],
plugins: [
typescript({
tsconfig: "tsconfig.json",
useTsconfigDeclarationDir: true,
}),
resolve(),
commonjs(),
],
},
// Docs script configuration
{
input: "docs/script.ts",
output: {
file: "docs/script.js",
format: "iife",
name: "app",
},
plugins: [
typescript({
tsconfig: "tsconfig.json",
tsconfigOverride: {
include: ["docs/script.ts", "src/**/*.ts"],
compilerOptions: {
declaration: false,
},
},
}),
resolve({
browser: true,
}),
commonjs(),
dev &&
serve({
open: true,
contentBase: "docs",
port: 3000,
}),
dev && livereload("docs"),
],
},
];