forked from panter/vue-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
33 lines (29 loc) · 999 Bytes
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const path = require('path');
const pack = require('./package.json');
const replace = require('rollup-plugin-replace');
// const flow = require('rollup-plugin-flow-no-whitespace');
const buble = require('rollup-plugin-buble');
const node = require('rollup-plugin-node-resolve');
const cjs = require('rollup-plugin-commonjs');
const resolve = _path => path.resolve(__dirname, _path);
const name = 'VueI18next';
const fileName = 'vue-i18next';
const replacePluginOptions = { __VERSION__: `"${pack.version}"` };
const rollupPlugins = () => [
replace(replacePluginOptions),
buble({ objectAssign: 'Object.assign' }),
node(),
cjs(),
];
const conf = (format, formatName) => ({
input: 'src/i18n.js',
plugins: rollupPlugins(),
external: ['deepmerge'],
output: {
file: resolve(`dist/${fileName}${formatName ? `.${formatName}` : ''}.js`),
format,
env: 'production',
name,
},
});
export default [conf('cjs', 'common'), conf('es', 'esm'), { ...conf('umd'), external: [] }];