-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
70 lines (63 loc) · 1.62 KB
/
rollup.config.mjs
File metadata and controls
70 lines (63 loc) · 1.62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//@ts-check
import terser from "@rollup/plugin-terser";
import css from "rollup-plugin-import-css";
import htmlString from "rollup-plugin-html-string";
export default function () {
//Place a var at the top of generated source
const banner = ""; //`var EurekaVersion="${publishPackageJsonVersion}";`;
//const plugins = [];
const format = "esm";
// Minify in normal build only
//const plugins = process.env["ROLLUP_WATCH"] === "true" ? [] : [terser({ module: true })];
/** @type {import("@rollup/plugin-terser").Options} */
const terserOptions = {
module: true,
mangle: {
properties: {
regex: "^_"
}
}
};
// @ts-ignore
const plugins = [terser(terserOptions)];
/** @type {import("html-minifier").Options} **/
const htmlMinifierOptions = {
collapseWhitespace: true,
collapseBooleanAttributes: true,
conservativeCollapse: true,
minifyJS: true,
removeComments: true
};
return {
plugins: [
css({ minify: true, modules: false }),
htmlString({
htmlMinifierOptions
})
],
input: "src/js/bundle.js",
output: [
{
file: "_site/js/eureka.core.js",
format,
banner
},
{
file: "_site/js/eureka.core.min.js",
format,
plugins,
banner
}
],
onwarn: function (
/** @type {{ code: string; message: string; }} */ warning
) {
// should intercept warnings but doesn't in some rollup versions
if (warning.code === "THIS_IS_UNDEFINED") {
return;
}
// console.warn everything else
console.warn(warning.message);
}
};
}