forked from npolar/mdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (42 loc) · 1.1 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
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { eslint } from "rollup-plugin-eslint";
import { terser } from "rollup-plugin-terser";
import filesize from "rollup-plugin-filesize";
import liveserver from "rollup-plugin-live-server";
import pkg from "./package.json";
const exclude = ["lit-element", "lit-html", "lit-translate"];
const deps = [...Object.keys(pkg.dependencies)].filter(
name => !exclude.includes(name)
);
const input = ["src/demo-app.js"]; //, ...deps];
const dir = "dist";
const format = "esm";
const output = { format, dir };
const terserConfig = {
parse: {
html5_comments: false
},
output: {
comments: false
}
};
let plugins = [nodeResolve(), commonjs(), filesize()];
const app = {
input,
output,
plugins
};
const { ROLLUP_WATCH } = process.env;
if (ROLLUP_WATCH) {
const liveserverConfig = {
root: dir,
open: false,
file: "index.html",
port: 7777
};
plugins = [...plugins, liveserver(liveserverConfig)];
} else {
plugins = [...plugins, eslint(), terser(terserConfig)];
}
export default [app];