-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathrollup.config.js
More file actions
41 lines (40 loc) · 1.01 KB
/
rollup.config.js
File metadata and controls
41 lines (40 loc) · 1.01 KB
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
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" };
const minOutBase = { banner: bannerShort, name: pkg.name, plugins: [terser()], sourcemap: true };
export default [
{
input: "./src/lru.js",
output: [
{
...cjOutBase,
file: `dist/${pkg.name}.cjs`,
},
{
...esmOutBase,
file: `dist/${pkg.name}.js`,
},
{
...esmOutBase,
...minOutBase,
file: `dist/${pkg.name}.min.js`,
},
],
},
];