forked from AzureAD/microsoft-authentication-library-for-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
99 lines (96 loc) · 2.68 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { nodeResolve } from "@rollup/plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import { terser } from "rollup-plugin-terser";
import pkg from "./package.json";
const libraryHeader = `/*! ${pkg.name} v${pkg.version} ${new Date().toISOString().split("T")[0]} */`;
const useStrictHeader = "'use strict';";
const fileHeader = `${libraryHeader}\n${useStrictHeader}`;
export default [
{
// for es build
input: "src/index.ts",
output: {
dir: "dist",
preserveModules: true,
preserveModulesRoot: "src",
format: "es",
banner: fileHeader,
sourcemap: true,
},
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false
},
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
plugins: [
typescript({
typescript: require("typescript"),
tsconfig: "tsconfig.build.json"
})
]
},
{
input: "src/index.ts",
preserveModules: false,
output: [
{
file: pkg.main,
format: "cjs",
banner: fileHeader,
sourcemap: true,
},
{
file: "./lib/msal-browser.js",
format: "umd",
name: "msal",
banner: fileHeader,
sourcemap: true,
}
],
plugins: [
nodeResolve({
browser: true,
resolveOnly: ["@azure/msal-common", "tslib"]
}),
typescript({
typescript: require("typescript"),
tsconfig: "tsconfig.build.json"
})
]
},
{
// Minified version of msal
input: "src/index.ts",
output: [
{
file: "./lib/msal-browser.min.js",
format: "umd",
name: "msal",
banner: useStrictHeader,
sourcemap: false,
}
],
plugins: [
nodeResolve({
browser: true,
resolveOnly: ["@azure/msal-common", "tslib"]
}),
typescript({
typescript: require("typescript"),
tsconfig: "tsconfig.build.json"
}),
terser({
output: {
preamble: libraryHeader
}
})
]
}
];