Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.08 KB | None | 0 0
  1. import babel from 'rollup-plugin-babel';
  2. import globals from 'rollup-plugin-node-globals';
  3. import commonjs from 'rollup-plugin-commonjs';
  4. import replace from 'rollup-plugin-replace';
  5. import resolve from 'rollup-plugin-node-resolve';
  6. import uglify from 'rollup-plugin-uglify';
  7.  
  8. const config = {
  9.   input: 'src/index.js',
  10.   output: {
  11.     file: 'build/bundle.js',
  12.     format: 'iife'
  13.   },
  14.   plugins: [
  15.     resolve({
  16.       preferBuiltins: false,
  17.       browser: true,
  18.       jsnext: true
  19.     }),
  20.     commonjs({
  21.       include: 'node_modules/**'
  22.     }),
  23.     babel({ babelrc: true }),
  24.     globals(),
  25.     replace({
  26.       'process.env.NODE_ENV': JSON.stringify('development')
  27.     })
  28.   ]
  29. };
  30.  
  31. if (process.env.NODE_ENV == 'production') {
  32.   config.output.file = 'build/bundle.min.js';
  33.   config.plugins[3] = replace({ 'process.env.NODE_ENV': JSON.stringify('production') });
  34.   config.plugins.push(
  35.     uglify({
  36.       compress: {
  37.         pure_getters: true,
  38.         unsafe: true,
  39.         unsafe_comps: true,
  40.         warnings: false
  41.       }
  42.     })
  43.   );
  44. }
  45.  
  46. export default config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement