generated from esm-bundle/autopublish-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
45 lines (42 loc) · 1.34 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
import { join } from "path";
import { terser } from "rollup-plugin-terser";
import packageJson from "@angular/core/package.json";
export default [
...["2022"]
.map((ecma) => [
createConfig({ ecma, prod: false, format: "system" }),
createConfig({ ecma, prod: true, format: "system" }),
createConfig({ ecma, prod: false, format: "es" }),
createConfig({ ecma, prod: true, format: "es" }),
])
.flat(),
];
function createConfig({ ecma, prod, format }) {
const dir = (format === "es" ? "." : format) + `/es${ecma}/ivy`;
return {
input: join(__dirname, `node_modules/@angular/core/fesm${ecma}/core.mjs`),
output: {
file: `${dir}/angular-core.${prod ? "min." : ""}js`,
format,
sourcemap: true,
banner: `/* esm-bundle - @angular/core@${packageJson.version} - Ivy - ${format} format - Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license */`,
},
plugins: [
prod &&
terser({
format: {
ecma,
comments: /esm-bundle/,
},
compress: {
global_defs: {
ngJitMode: false,
ngDevMode: false,
ngI18nClosureMode: false,
},
},
}),
],
external: ["rxjs", "rxjs/operators"],
};
}