darkness-dependent-vision/rollup.config.js

42 lines
909 B
JavaScript
Raw Permalink Normal View History

2021-06-29 05:27:27 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { copy } from '@guanghechen/rollup-plugin-copy';
import { terser } from 'rollup-plugin-terser';
import { distDirectory, name, sourceDirectory } from './tools/const.mjs';
2022-02-01 13:11:13 +01:00
const staticFiles = [
'.reuse',
2022-02-01 13:47:54 +01:00
'img',
2022-02-01 13:11:13 +01:00
'lang',
'LICENSE.md',
'LICENSES',
'module.json.license',
'module.json',
'README.md',
'templates',
];
const isProduction = process.env.NODE_ENV === 'production';
2022-02-01 13:11:13 +01:00
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
2022-02-01 13:11:13 +01:00
input: { [`${name}`]: `${sourceDirectory}/${name}.js` },
2021-06-29 05:27:27 +02:00
output: {
dir: distDirectory,
2021-06-29 05:27:27 +02:00
format: 'es',
sourcemap: true,
assetFileNames: '[name].[ext]',
2021-06-29 05:27:27 +02:00
},
plugins: [
copy({
2022-02-01 13:11:13 +01:00
targets: [{ src: staticFiles, dest: distDirectory }],
}),
isProduction && terser({ ecma: 2020, keep_fnames: true }),
],
2021-06-29 05:27:27 +02:00
};
export default config;