-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
35 lines (34 loc) · 877 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
import terser from "@rollup/plugin-terser";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");
const year = new Date().getFullYear();
const bannerLong = `/**
* ${pkg.name}
*
* @copyright ${year} ${pkg.author}
* @license ${pkg.license}
* @version ${pkg.version}
*/`;
const bannerShort = `/*!
${year} ${pkg.author}
@version ${pkg.version}
*/`;
const defaultOutBase = {compact: true, banner: bannerLong, name: pkg.name};
const cjOutBase = {...defaultOutBase, compact: false, format: "cjs", exports: "named"};
const esmOutBase = {...defaultOutBase, format: "esm"};
export default [
{
input: "./index.js",
output: [
{
...cjOutBase,
file: `dist/${pkg.name}.cjs`
},
{
...esmOutBase,
file: `dist/${pkg.name}.mjs`
},
]
}
];