Ted Humphrey | 01e5fde | 2020-01-27 18:57:39 -0500 | [diff] [blame] | 1 | import babel from 'rollup-plugin-babel' |
| 2 | import commonjs from '@rollup/plugin-commonjs' |
| 3 | import postcss from 'rollup-plugin-postcss' |
| 4 | import resolve from '@rollup/plugin-node-resolve' |
| 5 | import external from 'rollup-plugin-peer-deps-external' |
| 6 | import img from '@rollup/plugin-image' |
| 7 | |
| 8 | import pkg from './package.json' |
| 9 | |
| 10 | export default { |
| 11 | input: './libIndex.js', |
| 12 | output: [ |
| 13 | { |
| 14 | file: pkg.main, |
| 15 | format: 'cjs', |
| 16 | sourcemap: true |
| 17 | }, |
| 18 | { |
| 19 | file: pkg.module, |
| 20 | format: 'es', |
| 21 | sourcemap: true |
| 22 | } |
| 23 | ], |
| 24 | plugins: [ |
| 25 | img(), |
| 26 | external(), |
| 27 | postcss({ |
| 28 | modules: true |
| 29 | }), |
| 30 | babel({ |
| 31 | exclude: 'node_modules/**', |
| 32 | presets: [ |
| 33 | |
| 34 | "@babel/preset-env", {}, |
| 35 | "@babel/preset-react", {} |
| 36 | ], |
| 37 | plugins: [ |
| 38 | [ |
| 39 | "@babel/plugin-proposal-class-properties", |
| 40 | { |
| 41 | "loose": true |
| 42 | } |
| 43 | ] |
| 44 | ] |
| 45 | }), |
| 46 | resolve({ preferBuiltins: true, mainFields: ['browser'] }) |
| 47 | ] |
| 48 | } |