forked from RainLoop/rainloop-webmail
-
-
Notifications
You must be signed in to change notification settings - Fork 128
/
rollup.config.js
95 lines (90 loc) · 2 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
npm install rollup rollup-plugin-includepaths rollup-plugin-babel rollup-plugin-external-globals rollup-plugin-html rollup-plugin-terser
rollup -c
*/
import babel from 'rollup-plugin-babel';
import includePaths from 'rollup-plugin-includepaths';
import externalGlobals from "rollup-plugin-external-globals";
import html from 'rollup-plugin-html';
import { terser } from "rollup-plugin-terser";
let includePathOptions = {
include: {},
paths: ['dev'],
external: [],
extensions: ['.js', '.html']
};
let babelConfig = {
exclude: 'node_modules/**',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
targets: {"chrome": "60"},
loose: true,
modules: false
}
]
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true
}
],
'@babel/plugin-proposal-class-properties'
]
};
let terserConfig = {
output: {
comments: false
},
keep_classnames: true, // Required for AbstractModel and AbstractCollectionModel
compress:{
ecma: 2020,
drop_console: true
/*
,hoist_props: false
,keep_fargs: false
,toplevel: true
,unsafe_arrows: true // Issue with knockoutjs
,unsafe_methods: true
,unsafe_proto: true
*/
}
// ,mangle: {reserved:['SendMessage']}
};
export default [{
external: ['ko'],
input: 'dev/admin.js',
// dest: 'snappymail/v/0.0.0/static/js/admin.rollup.js',
output: [
{file: 'snappymail/v/0.0.0/static/js/admin.js', format: 'iife'}, // format: 'es'
{file: 'snappymail/v/0.0.0/static/js/min/admin.min.js', format: 'iife', plugins: [terser(terserConfig)], }
],
plugins: [
babel(babelConfig),
includePaths(includePathOptions),
externalGlobals({
ko: 'ko'
})
],
}, {
external: ['ko'],
input: 'dev/app.js',
output: [
{file: 'snappymail/v/0.0.0/static/js/app.js', format: 'iife'},
{file: 'snappymail/v/0.0.0/static/js/min/app.min.js', format: 'iife', plugins: [terser(terserConfig)], }
],
plugins: [
babel(babelConfig),
includePaths(includePathOptions),
externalGlobals({
ko: 'ko'
}),
html({
include: '**/*.html'
})
]
}];