-
Notifications
You must be signed in to change notification settings - Fork 12
/
rollup.config.js
46 lines (44 loc) · 1.47 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
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import sass from 'rollup-plugin-sass';
import path from 'path';
import license from 'rollup-plugin-license';
import resolve from '@rollup/plugin-node-resolve';
// import typescript from '@rollup/plugin-typescript'; // supports declarations generation
import ts from 'rollup-plugin-ts'; // supports declarations generation
const NODE_ENV = process.env.NODE_ENV || 'development';
const outputFile = NODE_ENV === 'examples' ? './docs/js/examples-umd.js' : (NODE_ENV === 'production' ? './dist/index.js' : './dist/dev.js');
export default {
input: './src/index.ts',
output: {
file: outputFile,
format: NODE_ENV === 'examples' ? 'umd' : 'cjs',
name: NODE_ENV === 'examples' ? 'ReactBootstrapCountrySelect' : undefined,
sourcemap: true,
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
}),
ts(),
babel({
exclude: ['node_modules/**'],
}),
commonjs(),
...(NODE_ENV === 'examples' ? [ resolve() ] : []),
sass({
output: './dist/react-bootstrap-country-select.css',
}),
license({
sourcemap: true,
banner: {
content: {
file: path.join(__dirname, 'LICENSE'),
encoding: 'utf-8',
},
},
}),
],
external: NODE_ENV === 'examples' ? [ 'react', 'react-dom'] : [ 'react', 'react-bootstrap', 'react-dom', 'classnames' ],
};