-
Notifications
You must be signed in to change notification settings - Fork 44
/
rollup.config.js
44 lines (41 loc) · 978 Bytes
/
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
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
const plugins = [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
babel({
babelrc: false,
presets: ['@babel/preset-env'],
}),
];
const createConfig = (umd, name, input = name) => ({
input: `src/${input}.js`,
output: [
{
name: umd,
file: `dist/${name}.umd.js`,
format: 'umd',
},
{
file: `dist/${name}.common.js`,
format: 'cjs',
},
],
plugins,
});
export default [
createConfig('WebViewInvoke', 'browser'),
createConfig('WebViewCreateInvoke', 'factory', 'messager/index'),
{
input: 'src/native.js',
output: {
file: 'dev/src/native.js',
format: 'es',
},
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
],
},
];