-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
40 lines (36 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
import typescript from "@rollup/plugin-typescript";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import license from "rollup-plugin-license";
import commonjs from "@rollup/plugin-commonjs";
import packageJson from "./package.json";
const TERSER_CONFIG = {
output: {
comments: false,
},
};
const LICENSE_CONFIG = {
banner: {
commentStyle: "ignored",
content: `rubberband-wasm v${packageJson.version} (https://www.npmjs.com/package/rubberband-wasm)
(c) Dani Biro
@license GPLv2`,
},
};
const getBundleConfig = (minified = false) => ({
input: "src/index.ts",
output: [
{
file: `dist/index.umd${minified ? ".min" : ""}.js`,
name: "rubberband",
format: "umd",
},
{
file: `dist/index.esm${minified ? ".min" : ""}.js`,
format: "es",
},
],
plugins: [nodeResolve(), commonjs(), json(), typescript(), ...(minified ? [terser(TERSER_CONFIG)] : []), license(LICENSE_CONFIG)],
});
export default [getBundleConfig(false), getBundleConfig(true)];