-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
51 lines (46 loc) · 1.13 KB
/
rollup.config.js
File metadata and controls
51 lines (46 loc) · 1.13 KB
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
50
51
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import terser from "@rollup/plugin-terser";
import versionInjector from "rollup-plugin-version-injector";
import { readFileSync } from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const pkg = JSON.parse(
readFileSync(path.resolve(__dirname, "package.json"), "utf-8"),
);
const basePlugins = [resolve(), commonjs(), versionInjector()];
const baseInput = "src/index.js";
export default [
// UMD build - minified and unminified
{
input: baseInput,
output: [
{
name: "angular",
file: pkg.browser.replace(/\.js$/, ".min.js"),
format: "umd",
plugins: [terser()],
},
{
name: "angular",
file: pkg.browser,
format: "umd",
},
],
plugins: basePlugins,
},
// ESM build
{
input: baseInput,
external: ["ms"],
output: [
{
file: pkg.module,
format: "es",
},
],
plugins: [versionInjector()],
},
];