-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
40 lines (35 loc) · 1.02 KB
/
rollup.config.js
File metadata and controls
40 lines (35 loc) · 1.02 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
import { terser } from "rollup-plugin-terser";
const publishPackageJsonVersion = require("./publish/package.json").version;
//const projectPackageJsonVersion = process.env.npm_package_version;
//Place a var at the top of generated source
const banner = `var StateTemplateNpmPackageVersion="${publishPackageJsonVersion}";`;
const format = "esm";
// Minify in normal build only
const plugins =
process.env["ROLLUP_WATCH"] === "true" ? [] : [terser({ module: false })];
export default [
{
input: "src/js/index.js",
output: [
{
file: "_site/ca_state_template/js/cagov.core.js",
format,
banner
},
{
file: "_site/ca_state_template/js/cagov.core.min.js",
format,
plugins,
banner
}
],
onwarn: function (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);
}
}
];