-
Notifications
You must be signed in to change notification settings - Fork 7
/
rollup.js
49 lines (45 loc) · 1.14 KB
/
rollup.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
/* eslint-disable import/no-extraneous-dependencies */
const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const pkg = require('./package.json');
const plugins = [babel(), resolve(), commonjs()];
const external = ['react', 'react-native'].concat(Object.keys(pkg.dependencies));
rollup
.rollup({
input: './src/index.js',
plugins,
external,
})
.then(bundle => {
bundle.write({
file: pkg.main,
format: 'cjs',
sourcemap: true,
});
bundle.write({
file: pkg.module,
format: 'es',
sourcemap: true,
});
})
.catch(e => {
console.log(e);
});
rollup
.rollup({
input: './src/index.ReactNative.js',
plugins,
external,
})
.then(bundle => {
bundle.write({
file: './dist/react-text-mask-hoc.ReactNative.js',
format: 'es',
sourcemap: true,
});
})
.catch(e => {
console.log(e);
});