ds4/rollup.config.js

64 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-06-26 22:02:00 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import styles from "@ironkinoko/rollup-plugin-styles";
import { swc } from "rollup-plugin-swc3";
import { copy } from "@guanghechen/rollup-plugin-copy";
2022-08-22 22:05:14 +02:00
import { distDirectory, name, sourceDirectory } from "./tools/const.js";
const staticFiles = [
2023-07-10 22:23:13 +02:00
".reuse",
"assets",
"ATTRIBUTION.md",
"fonts",
"lang",
"LICENSE.md",
"LICENSES",
"README.md",
"system.json.license",
"system.json",
"template.json.license",
"template.json",
"templates",
];
const isProduction = process.env.NODE_ENV === "production";
2021-03-17 12:15:25 +01:00
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
2023-07-10 22:23:13 +02:00
input: { [name]: `${sourceDirectory}/${name}.ts` },
output: {
dir: distDirectory,
format: "es",
sourcemap: true,
assetFileNames: "[name].[ext]",
},
plugins: [
swc({
jsc: {
minify: isProduction && {
sourceMap: true,
mangle: {
keepClassNames: true,
keepFnNames: true,
},
},
},
sourceMaps: true,
}),
styles({
mode: ["extract", `css/${name}.css`],
url: false,
sourceMap: true,
minimize: isProduction,
}),
copy({ targets: [{ src: staticFiles, dest: distDirectory }] }),
],
2021-03-17 12:15:25 +01:00
};
export default config;