|
| 1 | +import minimist from 'minimist'; |
| 2 | +import vue from 'rollup-plugin-vue'; |
| 3 | +import babel from '@rollup/plugin-babel'; |
| 4 | +import typescript from 'rollup-plugin-typescript2'; |
| 5 | +import ttypescript from 'ttypescript'; |
| 6 | +import json from '@rollup/plugin-json'; |
| 7 | + |
| 8 | +import baseConfig from './rollup.config.base'; |
| 9 | + |
| 10 | +const argv = minimist(process.argv.slice(2)); |
| 11 | + |
| 12 | +const external = ['vue']; |
| 13 | + |
| 14 | +const buildFormats = []; |
| 15 | + |
| 16 | +// ES file build config |
| 17 | +// Currently we only support es build |
| 18 | +if (!argv.format || argv.format === 'es') { |
| 19 | + const merged = { |
| 20 | + input: 'src/polaris-vue.ts', |
| 21 | + external, |
| 22 | + output: { |
| 23 | + file: 'dist/polaris-vue.js', |
| 24 | + format: 'esm', |
| 25 | + exports: 'named', |
| 26 | + }, |
| 27 | + plugins: [ |
| 28 | + ...baseConfig.plugins.preVue, |
| 29 | + json(), |
| 30 | + vue(baseConfig.plugins.vue), |
| 31 | + ...baseConfig.plugins.postVue, |
| 32 | + typescript({ |
| 33 | + typescript: ttypescript, |
| 34 | + useTsconfigDeclarationDir: true, |
| 35 | + emitDeclarationOnly: true, |
| 36 | + }), |
| 37 | + babel({ |
| 38 | + ...baseConfig.plugins.babel, |
| 39 | + presets: [['@babel/preset-env']], |
| 40 | + }), |
| 41 | + ], |
| 42 | + }; |
| 43 | + |
| 44 | + buildFormats.push(merged); |
| 45 | +} |
| 46 | + |
| 47 | +// Export config |
| 48 | +export default buildFormats; |
0 commit comments