-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.mjs
35 lines (33 loc) · 941 Bytes
/
rollup.config.mjs
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
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "rollup";
import typescript from "rollup-plugin-typescript2";
import nodeResolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import ts from "typescript";
const createConfig = (outputFormat, env = null) =>
defineConfig({
input: fileURLToPath(new URL("./src/index.ts", import.meta.url)),
plugins: [
nodeResolve(),
typescript({
typescript: ts,
}),
env === "production" &&
terser({
output: { comments: false },
ecma: 5,
}),
],
output: {
file: `dist/giftexchange.${outputFormat}${env ? "." + env : ""}.js`,
format: outputFormat,
name: "GiftExchange",
sourcemap: true,
},
});
export default [
createConfig("esm"),
createConfig("cjs"),
createConfig("umd", "development"),
createConfig("umd", "production"),
];