-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.config.js
42 lines (38 loc) · 949 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
36
37
38
39
40
41
42
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import pkg from "./package.json";
import * as fs from "fs";
import path from "path";
const libFolderPath = path.join(__dirname, "./lib");
// Create lib folder
if (!fs.existsSync(libFolderPath)) {
fs.mkdirSync(libFolderPath);
}
// move index.d.ts to /lib
fs.createReadStream(path.join(__dirname, "src/index.d.ts")).pipe(
fs.createWriteStream(path.join(__dirname, "lib/index.d.ts"))
);
export default {
input: "src/index.js",
output: [
{
name: "cryptoformat",
file: pkg.browser,
format: "umd",
},
{
name: "cryptoformat",
file: pkg.main,
format: "cjs",
},
{
name: "cryptoformat",
file: pkg.module,
format: "es",
},
],
plugins: [
resolve(), // so Rollup can find `dependencies`
commonjs(), // so Rollup can convert `dependencies` to an ES module
],
};