-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
59 lines (51 loc) · 1.39 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
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 liveserver from "rollup-plugin-live-server";
import pkg from "./package.json";
const exclude = ["@npolar/mdc", "@npolar/idb-store", "@npolar/placenames"];
const deps = [...Object.keys(pkg.dependencies)].filter(
(name) => !exclude.includes(name)
);
const input = ["src/placenames-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()];
const app = {
input,
output,
plugins,
};
const { ROLLUP_WATCH } = process.env;
if (ROLLUP_WATCH) {
const liveserverConfig = {
root: "dist",
open: false,
file: "index.html",
port: 1596,
};
plugins = [...plugins, terser(terserConfig), liveserver(liveserverConfig)];
} else {
plugins = [...plugins, eslint(), terser(terserConfig)];
}
// const worker = {
// input: "src/worker.js",
// output: { format, file: `${dir}/worker.js` },
// plugins
// };
// const workerFlexsearch = {
// input: "src/placenames-search/worker-placenames-search.js",
// output: { format, file: `${dir}/worker-placenames-search.js` },
// plugins
// };
export default [app];