-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
64 lines (57 loc) · 1.43 KB
/
rollup.config.mjs
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
import { babel } from "@rollup/plugin-babel";
import terser from "@rollup/plugin-terser";
const plugins = {
production: [
babel({
babelHelpers: "bundled",
presets: ["@babel/preset-env"],
}),
terser({
keep_fnames: true,
}),
],
development: []
}
const defaultPlugins = plugins[process.env.NODE_ENV];
const generateRollupConfig = ({
input,
output,
format = "cjs",
plugins = defaultPlugins,
context = "window",
}) => {
return {
input,
output: {
file: output,
format,
},
plugins,
context,
};
};
const config = [
generateRollupConfig({ input: "./public/src/js/silverBox.js", output: "./public/dist/js/silverBox.js", format: "es", plugins: [] }),
generateRollupConfig({
input: "./public/src/js/silverBox.js", output: "./public/dist/js/silverBox.min.js", format: "es", plugins: [
babel({
babelHelpers: "bundled",
presets: ["@babel/preset-env"],
}),
terser({
keep_fnames: true,
}),
]
}),
generateRollupConfig({
input: "./public/src/js/libraries/highlightJS/highlight.min.js", output: "./public/dist/js/libraries/highlightJS/highlight.min.js", plugins: [
babel({
babelHelpers: "bundled",
presets: ["@babel/preset-env"],
}),
]
}),
generateRollupConfig({ input: "./public/src/js/index.js", output: "./public/dist/js/index.js" }),
generateRollupConfig({ input: "./public/src/js/documentationPage.js", output: "./public/dist/js/documentationPage.js" })
];
export default config;