|
1 | 1 | import {terser} from 'rollup-plugin-terser';
|
2 | 2 | import pkg from './package.json';
|
| 3 | +import commonjs from '@rollup/plugin-commonjs'; |
3 | 4 | import nodeResolve from '@rollup/plugin-node-resolve';
|
4 |
| -const getConfig = (en) => ({ |
5 |
| - input: pkg.module, |
6 |
| - output: { |
7 |
| - file: en === 'dev' ? 'dist/react-dyn-tabs.umd.js' : 'dist/react-dyn-tabs.umd.min.js', |
8 |
| - format: 'umd', |
9 |
| - name: 'useDynTabs', |
10 |
| - globals: { |
11 |
| - 'prop-types': 'PropTypes', |
12 |
| - 'react-dom': 'ReactDOM', |
13 |
| - react: 'React', |
| 5 | +const getConfig = (en, pf) => { |
| 6 | + var pfName = pf ? '.including-polyfills' : ''; |
| 7 | + return { |
| 8 | + input: pf ? 'lib/esm-including-polyfills/index.js' : pkg.module, |
| 9 | + output: { |
| 10 | + file: en === 'dev' ? 'dist/react-dyn-tabs' + pfName + '.umd.js' : 'dist/react-dyn-tabs' + pfName + '.umd.min.js', |
| 11 | + format: 'umd', |
| 12 | + name: 'useDynTabs', |
| 13 | + globals: { |
| 14 | + 'prop-types': 'PropTypes', |
| 15 | + 'react-dom': 'ReactDOM', |
| 16 | + react: 'React', |
| 17 | + }, |
| 18 | + sourcemap: true, |
14 | 19 | },
|
15 |
| - sourcemap: true, |
16 |
| - }, |
17 |
| - plugins: (function () { |
18 |
| - const _plugins = [nodeResolve({preferBuiltins: false})]; |
19 |
| - if (en === 'prod') { |
20 |
| - _plugins.push(terser()); |
21 |
| - } |
22 |
| - return _plugins; |
23 |
| - })(), |
24 |
| - external: function (id) { |
25 |
| - return /prop-types$|react$|react-dom$|.test.js$|.js.snap$|.css$/g.test(id); |
26 |
| - }, |
27 |
| -}); |
28 |
| -export default [getConfig('dev'), getConfig('prod')]; |
| 20 | + plugins: (function () { |
| 21 | + const _plugins = [nodeResolve({preferBuiltins: false}), commonjs()]; |
| 22 | + if (en === 'prod') { |
| 23 | + _plugins.push(terser()); |
| 24 | + } |
| 25 | + return _plugins; |
| 26 | + })(), |
| 27 | + external: function (id) { |
| 28 | + return /prop-types$|react$|react-dom$|.test.js$|.js.snap$|.css$/g.test(id); |
| 29 | + }, |
| 30 | + }; |
| 31 | +}; |
| 32 | +export default [getConfig('dev'), getConfig('prod'), getConfig('dev', true), getConfig('prod', true)]; |
0 commit comments