-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.config.js
55 lines (47 loc) · 1.12 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
// rollup.config.js
//
// "@rollup/plugin-babel": "^5.2.1",
// "@rollup/plugin-node-resolve": "^9.0.0",
//
// "rollup": "^2.31.0"
import babel from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
let production = process.env.build_env === 'prod' || process.env.build_env === 'production';
let pkg = process.env.pkg;
const plugins = [
nodeResolve()
];
if (production){
plugins.push(
babel({
exclude: 'node_modules/**', // only transpile our source code
babelHelpers: 'bundled',
})
)
}
let pages = [
'cards_home',
'climate_graphs',
'climate_maps',
'high_tide_flooding',
'historical_thresholds',
'historical_weather_data',
'index',
'next_steps'
]; // Pages 404, error, about, faq, glossary do not have their own JS packages
let packages = []
for(const p of pages) {
if (!pkg || p === pkg) {
packages.push({
input: `./js/${p}.js`,
output: {
file: `./dist/js/${p}.js`,
format: 'umd',
name: p,
sourcemap: !production ? 'inline' : false,
},
plugins: plugins
})
}
}
export default packages;