-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
44 lines (39 loc) · 991 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
41
42
43
44
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import copy from '@guanghechen/rollup-plugin-copy';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import { distDirectory, name, sourceDirectory } from './tools/const.mjs';
const staticFiles = [
'.reuse',
'CHANGELOG.md.license',
'CHANGELOG.md',
'lang',
'LICENSE.md',
'LICENSES',
'media',
'module.json.license',
'module.json',
'README.md',
];
const isProduction = process.env.NODE_ENV === 'production';
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: { [`${name}`]: `${sourceDirectory}/${name}.ts` },
output: {
dir: distDirectory,
format: 'es',
sourcemap: true,
},
plugins: [
typescript({ noEmitOnError: true }),
copy({
targets: [{ src: staticFiles, dest: distDirectory }],
}),
isProduction && terser({ ecma: 2020, keep_fnames: true }),
],
};
export default config;