-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.build.js
56 lines (48 loc) · 1.04 KB
/
rollup.build.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
const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const plugins = [
resolve({}),
commonjs(),
babel({
babelrc: false,
presets: [
[
'env',
{
targets: {
node: 'current',
},
modules: false,
loose: true,
},
],
],
}),
];
async function build() {
let inputOptions = {
input: 'src/react.index.js',
plugins: plugins,
};
let outputOptions = {
format: 'es',
file: 'priv/elixir_script/react.js',
sourcemap: 'inline',
};
let bundle = await rollup.rollup(inputOptions);
await bundle.write(outputOptions);
inputOptions = {
input: 'src/react_dom.index.js',
plugins: plugins,
};
outputOptions = {
format: 'es',
file: 'priv/elixir_script/react_dom.js',
sourcemap: 'inline',
};
bundle = await rollup.rollup(inputOptions);
await bundle.write(outputOptions);
}
build();