forked from avoidwork/tiny-lru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
54 lines (52 loc) · 1.24 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 umdOutBase = {...defaultOutBase, format: "umd"};
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`
},
{
...umdOutBase,
file: `dist/${pkg.name}.umd.js`,
name: "lru"
},
{
...umdOutBase,
...minOutBase,
file: `dist/${pkg.name}.umd.min.js`,
name: "lru"
}
]
}
];