-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollup.config.js
49 lines (46 loc) · 1.09 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
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import packageDetails from "./package.json";
import copy from "rollup-plugin-copy";
const plugins = [
commonjs({
ignoreDynamicRequires: true,
}),
resolve({
preferBuiltins: true,
browser: process.env.BROWSER,
}),
copy({
targets: [
{ src: '../../node_modules/@tangle.js/streams-wasm/node/streams_bg.wasm', dest: 'dist/cjs' }
]
})
];
const globs = {};
for (const dep in packageDetails.dependencies) {
globs[dep] = dep;
}
export default {
inlineDynamicImports: true,
input: `./es/index.js`,
output: {
file: `dist/cjs/index.cjs`,
format: "cjs",
name: packageDetails.name
.split("-")
.map((p) => p[0].toUpperCase() + p.slice(1))
.join(""),
compact: false,
sourcemap: "inline",
exports: "auto",
globals: globs,
},
external: ["fs/promises"].concat(Object.keys(globs)),
onwarn: (message) => {
if (!["EMPTY_BUNDLE"].includes(message.code)) {
console.error(message);
process.exit(1);
}
},
plugins,
};