forked from esphome/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
38 lines (35 loc) · 1008 Bytes
/
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
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import json from "@rollup/plugin-json";
import typescript from "@rollup/plugin-typescript";
import manifest from "./build-scripts/rollup/manifest-plugin";
const isProdBuild = process.env.NODE_ENV === "production";
/**
* @type { import("rollup").MergedRollupOptions }
*/
const config = {
input: "src/index.ts",
output: {
dir: "esphome_dashboard/static/js/esphome/",
format: "module",
entryFileNames: isProdBuild ? "[name]-[hash].js" : "[name].js",
chunkFileNames: isProdBuild ? "c.[hash].js" : "[name].js",
assetFileNames: isProdBuild ? "a.[hash].js" : "[name].js",
},
preserveEntrySignatures: false,
plugins: [
typescript(),
nodeResolve(),
json(),
manifest(),
isProdBuild &&
terser({
ecma: 2019,
toplevel: true,
output: {
comments: false,
},
}),
].filter(Boolean),
};
export default config;