forked from cam-inc/viron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.base.config.js
70 lines (68 loc) · 1.71 KB
/
rollup.base.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
import mout from 'mout';
import buble from 'rollup-plugin-buble';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import builtins from 'rollup-plugin-node-builtins';
import nodeResolve from 'rollup-plugin-node-resolve';
import progress from 'rollup-plugin-progress';
import replace from 'rollup-plugin-re';
import riot from 'rollup-plugin-riot';
const namedExports = {};
mout.object.forOwn(mout, (v, k) => {
if (!mout.lang.isObject(v)) {
return;
}
const key = `node_modules/mout/${k}.js`;
if (!namedExports[key]) {
namedExports[key] = [];
}
mout.object.forOwn(v, (v1, k1) => {
if (mout.lang.isFunction(v1)) {
namedExports[key].push(k1);
}
});
});
// @see https://github.com/rollup/rollup/wiki/JavaScript-API
export default {
input: 'src/app.js',
output: {
file: 'dist/js/app.js',
sourcemap: false,
exports: 'none',
format: 'iife',
strict: false
},
context: 'window',
plugins: [
builtins(),
replace({
patterns: [{
test: /onTap="{.+?}"/g,
replace: str => {
const handlerName = str.replace('onTap="{', '').replace('}"', '').replace(/ /g, '');
return `onClick="{ getClickHandler('${handlerName}') }" onTouchStart="{ getTouchStartHandler() }" onTouchMove="{ getTouchMoveHandler() }" onTouchEnd="{ getTouchEndHandler('${handlerName}') }"`;
}
}]
}),
json(),
riot({
template: 'pug'
}),
nodeResolve({
jsnext: true,
main: true,
browser: true
}),
commonjs({
include: 'node_modules/**',
namedExports: namedExports
}),
buble({
target: {
chrome: 52,
edge: 13
}
}),
progress()
]
};