-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.js
61 lines (58 loc) · 1.62 KB
/
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
57
58
59
60
61
const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const multiEntry = require('rollup-plugin-multi-entry');
process.env.NODE_ENV = 'production';
const external = [
'styled-components',
'react',
'prop-types',
'polished',
'moment',
'react-custom-scrollbars',
'react-styled-flexboxgrid',
'react-router-dom',
'react-text-mask',
'react-input-autosize',
'text-mask-addons/dist/createAutoCorrectedDatePipe',
'text-mask-addons/dist/createNumberMask',
'lodash',
'downshift',
'i18next',
'react-day-picker',
'react-day-picker/DayPickerInput',
'react-onclickoutside',
'react-textarea-autosize',
// TODO: use `external` as function and Regex this shit
'typeface-roboto/files/roboto-latin-300.woff2',
'typeface-roboto/files/roboto-latin-400.woff2',
'typeface-roboto/files/roboto-latin-500.woff2',
'typeface-roboto/files/roboto-latin-700.woff2',
];
rollup
.rollup({
input: ['./src/index.js', './src/general/icon/index.js'],
external,
plugins: [
multiEntry(),
babel({
exclude: 'node_modules/**',
babelrc: false,
presets: ['react-cy-app'],
plugins: ['external-helpers']
}),
],
})
.then(bundle => {
bundle.write({
format: 'es',
file: 'dist/re-cy-cle.es.js',
});
bundle.write({
format: 'cjs',
file: 'dist/re-cy-cle.cjs.js',
});
})
.catch(err => {
console.log(String(err));
process.exit(1);
});