-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
51 lines (49 loc) · 1.32 KB
/
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
45
46
47
48
49
50
51
const { rollup } = require('rollup');
const babel = require('rollup-plugin-babel');
const resolve = require('@rollup/plugin-node-resolve');
const commonJS = require('@rollup/plugin-commonjs');
const { uglify } = require('rollup-plugin-uglify');
const sizes = require('rollup-plugin-sizes');
const filesize = require('rollup-plugin-filesize');
const production = process.env.NODE_ENV === 'production';
module.exports = module => {
return rollup({
input: module.input,
plugins: [
babel({
exclude: /node_modules\/(?!(dom7|ssr-window|swiper|micromodal|lozad)\/).*/,
presets: [
[
'@babel/preset-env',
{
modules: false
}
]
],
plugins: [
['@babel/transform-react-jsx', { pragma: 'h' }],
'@babel/plugin-proposal-class-properties'
]
}),
resolve(),
commonJS({
// ignore importing optional momentjs, which comes with pikaday
ignore: ['moment']
}),
production && uglify(),
production && sizes(),
production && filesize()
]
})
.then(bundle => {
return bundle.write({
file: module.file,
format: 'iife',
sourcemap: !production
});
})
.catch(err => {
console.error(err);
throw err;
});
};