-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
32 lines (30 loc) · 879 Bytes
/
rollup.config.mjs
File metadata and controls
32 lines (30 loc) · 879 Bytes
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
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "rollup";
import typescript from "@rollup/plugin-typescript";
import nodeResolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
const createConfig = (outputFormat, env = null) =>
defineConfig({
input: fileURLToPath(new URL("./src/index.ts", import.meta.url)),
plugins: [
nodeResolve(),
typescript(),
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"),
];