-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrollup.config.js
More file actions
60 lines (55 loc) · 1.39 KB
/
rollup.config.js
File metadata and controls
60 lines (55 loc) · 1.39 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
import minify from 'rollup-plugin-minify-es';
import minifyHTML from 'rollup-plugin-minify-html-literals';
import resolve from 'rollup-plugin-node-resolve';
import filesize from 'rollup-plugin-filesize';
const appDir = 'app';
function buildPlugins({dir=appDir, min=false}) {
let result = [];
result.push(resolve());
if (min) {
result.push(minifyHTML());
result.push(minify({
output: {
wrap_iife: true
}
}));
}
result.push(filesize());
return result;
}
function buildApp({dir=appDir, filename='index', min=false, format='umd'}) {
let minifyToken = (min) ? '.min': '';
let result = {
input: `${dir}/${filename}.js`,
plugins: buildPlugins({dir, min}),
external: [
'lit-element',
'wgnhs-common',
'wgnhs-styles',
'wgnhs-layout',
'wgnhs-pdf',
'wgnhs-router',
'@uirouter/visualizer',
],
output: {
file: `dist/${dir}/${filename}${minifyToken}.js`,
format: format,
name: dir,
sourcemap: min,
globals: {
'lit-element': 'wgnhs-common',
'wgnhs-common': 'wgnhs-common',
'wgnhs-styles': 'wgnhs-common',
'wgnhs-layout': 'wgnhs-layout',
'wgnhs-pdf': 'wgnhs-pdf',
'wgnhs-router': 'wgnhs-router',
'@uirouter/visualizer' : 'ui-router-visualizer',
}
}
}
return result;
}
export default [
buildApp({}),
buildApp({min: true})
];