rollup.config.js 904 B

1234567891011121314151617181920212223242526272829303132
  1. import babel from 'rollup-plugin-babel';
  2. import uglify from 'rollup-plugin-uglify';
  3. import nodeResolve from 'rollup-plugin-node-resolve';
  4. import { argv } from 'yargs';
  5. const format = argv.format || argv.f || 'iife';
  6. const compress = argv.uglify;
  7. const babelOptions = {
  8. exclude: 'node_modules/**',
  9. presets: [['es2015', { modules: false }], 'stage-0'],
  10. plugins: ['external-helpers', ['transform-es2015-classes', { loose: true }], 'transform-proto-to-assign'],
  11. babelrc: false
  12. };
  13. const dest = {
  14. amd: `dist/amd/i18next${compress ? '.min' : ''}.js`,
  15. umd: `dist/umd/i18next${compress ? '.min' : ''}.js`,
  16. iife: `dist/iife/i18next${compress ? '.min' : ''}.js`
  17. }[format];
  18. export default {
  19. entry: 'src/i18next.js',
  20. format,
  21. plugins: [
  22. babel(babelOptions),
  23. nodeResolve({ jsnext: true })
  24. ].concat(compress ? uglify() : []),
  25. moduleName: 'i18next',
  26. //moduleId: 'i18next',
  27. dest
  28. };