-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathrollup.config.js
46 lines (41 loc) · 1.15 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
// rollup.config.js
import typescript from 'rollup-plugin-typescript2';
import uglify from 'rollup-plugin-uglify';
import replace from 'rollup-plugin-replace';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import path from 'path';
const isDev = process.env.NODE_ENV !== 'production';
const config = {
input: path.resolve(__dirname, 'src/OwlCarousel.tsx'),
treeshake: {
pureExternalModules: true,
},
output: {
name: 'ReactOwlCarousel',
format: 'umd',
file: path.resolve(__dirname, 'umd/OwlCarousel.js'),
globals: {
react: 'React',
jquery: '$',
}
},
external: ['react', 'jquery'],
plugins: [
typescript({
typescript: require('typescript')
}),
resolve(),
commonjs({
include: /node_modules/
}),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
].concat()
}
if (!isDev) {
config.output.file = path.resolve(__dirname, 'umd/OwlCarousel.min.js');
config.plugins.push(uglify());
}
export default config;