-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup.config.mjs
40 lines (35 loc) · 941 Bytes
/
rollup.config.mjs
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
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import copy from "@guanghechen/rollup-plugin-copy";
import terser from "@rollup/plugin-terser";
import { distDirectory, entryPointName, sourceDirectory } from "./tools/const.mjs";
const staticFiles = [
"CHANGELOG.md",
"CONTRIBUTING.md",
"lang",
"LICENSE",
"module.json",
"README.md",
"styles",
"templates",
];
const isProduction = process.env.NODE_ENV === "production";
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: { [`${entryPointName}`]: `${sourceDirectory}/${entryPointName}.js` },
output: {
dir: distDirectory,
format: "es",
sourcemap: true,
},
plugins: [
copy({
targets: [{ src: staticFiles, dest: distDirectory }],
}),
isProduction && terser({ ecma: 2020, keep_fnames: true }),
],
};
export default config;