1 | import babel from 'rollup-plugin-babel';
|
2 | import wildcardExternal from '@oat-sa/rollup-plugin-wildcard-external';
|
3 | import resolve from 'rollup-plugin-node-resolve';
|
4 | import commonjs from 'rollup-plugin-commonjs';
|
5 | import { uglify } from 'rollup-plugin-uglify';
|
6 | import pkg from './package.json';
|
7 |
|
8 | export default [
|
9 | {
|
10 | input: 'src/index.js',
|
11 | output: [
|
12 | {
|
13 | file: pkg.main,
|
14 | format: 'cjs'
|
15 | },
|
16 | {
|
17 | file: pkg.module,
|
18 | format: 'esm'
|
19 | }
|
20 | ],
|
21 | external: [
|
22 | 'date-fns',
|
23 | 'prop-types',
|
24 | 'react',
|
25 | 'react-animate-height',
|
26 | 'react-datepicker',
|
27 | 'react-dom',
|
28 | 'react-overlays',
|
29 | 'react-popper',
|
30 | 'react-text-mask',
|
31 | 'react-transition-group/Transition',
|
32 | 'styled-components'
|
33 | ],
|
34 | plugins: [
|
35 | wildcardExternal([
|
36 | '@babel/**',
|
37 | 'lodash/**',
|
38 | 'core-js/**',
|
39 | 'text-mask-addons/**'
|
40 | ]),
|
41 | babel({
|
42 | exclude: ['node_modules/**'],
|
43 | runtimeHelpers: true
|
44 | })
|
45 | ]
|
46 | },
|
47 | {
|
48 | input: 'src/index.js',
|
49 | output: {
|
50 | file: 'bundle/main.min.js',
|
51 | format: 'umd',
|
52 | name: 'es-components',
|
53 | globals: {
|
54 | react: 'React',
|
55 | 'react-dom': 'ReactDOM',
|
56 | 'prop-types': 'PropTypes',
|
57 | 'styled-components': 'styled'
|
58 | }
|
59 | },
|
60 | external: ['react', 'react-dom', 'prop-types', 'styled-components'],
|
61 | plugins: [
|
62 | resolve(),
|
63 | commonjs({ include: /node_modules/ }),
|
64 | babel({
|
65 | exclude: /node_modules/,
|
66 | runtimeHelpers: true
|
67 | }),
|
68 | uglify()
|
69 | ]
|
70 | }
|
71 | ];
|