-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollup.config.build.ts
89 lines (84 loc) · 1.83 KB
/
rollup.config.build.ts
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { clean, copy, importStyles } from "@appnest/web-config";
import ts from "@wessberg/rollup-plugin-ts";
import autoprefixer from "autoprefixer";
import cssnano from "cssnano";
import { join, resolve } from "path";
import precss from "precss";
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import progress from "rollup-plugin-progress";
import pkg from "./package.json";
const folders = {
src: resolve(__dirname, "src/lib"),
dist: resolve(__dirname, "dist")
};
const files = {
src_index: join(folders.src, "index.ts"),
web_dialog: join(folders.src, "web-dialog.ts"),
util: join(folders.src, "util.ts"),
open_dialog: join(folders.src, "open-dialog.ts"),
// Package
src_package: resolve("package.json"),
dist_package: join(folders.dist, "package.json"),
// Readme
src_readme: resolve("README.md"),
dist_readme: join(folders.dist, "README.md")
};
export default {
input: {
index: files.src_index,
"web-dialog": files.web_dialog,
"open-dialog": files.open_dialog,
"util": files.util
},
output: [
{
dir: folders.dist,
format: "esm"
}
],
treeshake: false,
plugins: [
clean({
targets: [
folders.dist
]
}),
copy({
resources: [
[files.src_package, files.dist_package],
[files.src_readme, files.dist_readme]
]
}),
progress(),
nodeResolve({
modulesOnly: false,
mainFields: [
"module",
"browser",
"jsnext:main"
]
}),
importStyles({
plugins: [
precss(),
autoprefixer(),
cssnano()
]
}),
ts({
transpiler: "typescript",
tsconfig: "tsconfig.build.json",
exclude: ["node_modules/**/*.*"],
browserslist: false
}),
commonjs({
include: "**/node_modules/**"
})
],
external: [
...(Object.keys(pkg.dependencies || {})),
...(Object.keys(pkg.devDependencies || {})),
"tslib"
]
};