-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (41 loc) · 1.08 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
import copy from "rollup-plugin-copy";
import size from "rollup-plugin-bundle-size";
export default {
input: "modules/selectre.js",
output: [
{ file: "build/selectre.js", format: "cjs" },
{ file: "build/selectre.module.js", format: "esm" },
],
plugins: [
copy({
targets: [
{ src: ["modules/selectre.d.ts", "LICENSE"], dest: "build" },
{ src: "README_NPM.md", dest: "build", rename: "README.md" },
{ src: "package.json", dest: "build", transform: generatePkg },
],
}),
size(),
],
};
function generatePkg(contents) {
let pkg = JSON.parse(contents.toString());
return JSON.stringify(
{
name: pkg.name,
version: pkg.version,
description: pkg.description,
author: pkg.author,
license: pkg.license,
homepage: pkg.homepage,
repository: pkg.repository,
main: "./selectre.js",
module: "./selectre.module.js",
types: "./selectre.d.ts",
sideEffects: false,
files: ["*.js", "*.d.ts"],
keywords: ["react", "selector", "memoize", "state"],
},
null,
2,
);
}