| 1 | const {babel} = require('@rollup/plugin-babel'); |
| 2 | |
| 3 | const babelPlugin = babel({ |
| 4 | babelHelpers: 'bundled', |
| 5 | extensions: ['.js'], |
| 6 | }); |
| 7 | |
| 8 | const sourceFiles = [ |
| 9 | 'src/api.js', |
| 10 | 'src/full.js', |
| 11 | 'src/fullLangRegionMap.js', |
| 12 | 'src/langRegionMap.js', |
| 13 | 'src/main.js', |
| 14 | 'src/regionDayMap.js', |
| 15 | ]; |
| 16 | |
| 17 | module.exports = [ |
| 18 | { |
| 19 | input: sourceFiles, |
| 20 | output: { |
| 21 | dir: 'dist/commonjs', |
| 22 | format: 'cjs', |
| 23 | exports: 'named', |
| 24 | preserveModules: true, |
| 25 | preserveModulesRoot: 'src', |
| 26 | sourcemap: true, |
| 27 | }, |
| 28 | plugins: [babelPlugin], |
| 29 | }, |
| 30 | { |
| 31 | input: sourceFiles, |
| 32 | output: { |
| 33 | dir: 'dist/es-module', |
| 34 | format: 'es', |
| 35 | preserveModules: true, |
| 36 | preserveModulesRoot: 'src', |
| 37 | sourcemap: true, |
| 38 | }, |
| 39 | }, |
| 40 | { |
| 41 | input: 'src/main.js', |
| 42 | output: { |
| 43 | file: 'dist/main.js', |
| 44 | format: 'umd', |
| 45 | name: 'weekstart', |
| 46 | exports: 'named', |
| 47 | sourcemap: true, |
| 48 | }, |
| 49 | plugins: [babelPlugin], |
| 50 | }, |
| 51 | { |
| 52 | input: 'src/full.js', |
| 53 | output: { |
| 54 | file: 'dist/full.js', |
| 55 | format: 'umd', |
| 56 | name: 'weekstart', |
| 57 | exports: 'named', |
| 58 | sourcemap: true, |
| 59 | }, |
| 60 | plugins: [babelPlugin], |
| 61 | }, |
| 62 | ]; |