const pkg = require('./package.json');
const babel = require('rollup-plugin-babel');
const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');


module.exports = [
  // browser-friendly UMD build
  {
    entry: './src/index.js',
    exports: 'named',
    dest: pkg.browser,
    format: 'umd',
    moduleName: 'reactSelect3',
    sourceMap: true,
    plugins: [
      resolve(),
      commonjs({
        include: [
          'node_modules/**'
        ],
        exclude: [
          'node_modules/process-es6/**'
        ],
        namedExports: {
          'node_modules/react/react.js': ['Children', 'Component', 'PropTypes', 'createElement'],
          'node_modules/react-dom/index.js': ['render']
        }
      }),
      babel({
        babelrc: false,
        exclude: 'node_modules/**',
        presets: [
          'react',
          [
            'latest',
            {
              es2015: {
                modules: false
              }
            }
          ],
          'stage-0'
        ],
        plugins: ['external-helpers']
      })
    ]
  },

  // CommonJS (for Node) and ES module (for bundlers) build.
  // (We could have three entries in the configuration array
  // instead of two, but it's quicker to generate multiple
  // builds from a single configuration where possible, using
  // the `targets` option which can specify `dest` and `format`)
  {
    entry: './src/index.js',
    exports: 'named',
    sourceMap: true,
    targets: [
      { dest: pkg.main, format: 'cjs' },
      { dest: pkg.module, format: 'es' }
    ],
    plugins: [
      resolve(),
      commonjs({
        include: [
          'node_modules/**'
        ],
        exclude: [
          'node_modules/process-es6/**'
        ],
        namedExports: {
          'node_modules/react/react.js': ['Children', 'Component', 'PropTypes', 'createElement'],
          'node_modules/react-dom/index.js': ['render']
        }
      }),
      babel({
        babelrc: false,
        exclude: 'node_modules/**',
        presets: [
          "react",
          [
            "latest",
            {
              "es2015": {
                "modules": false
              }
            }
          ],
          "stage-0"
        ],
        plugins: ['external-helpers']
      })
    ]
  }
];

@@ -475,32 +475,33 @@
 node_modules/**'
+,
 %0A        %5D,%0A    
@@ -546,32 +546,33 @@
 /process-es6/**'
+,
 %0A        %5D,%0A    
@@ -736,32 +736,33 @@
 .js': %5B'render'%5D
+,
 %0A        %7D%0A     
@@ -747,32 +747,33 @@
 der'%5D,%0A        %7D
+,
 %0A      %7D),%0A     
@@ -977,24 +977,25 @@
 dules: false
+,
 %0A           
@@ -990,32 +990,33 @@
 %0A              %7D
+,
 %0A            %7D%0A 
@@ -1005,32 +1005,33 @@
 %7D,%0A            %7D
+,
 %0A          %5D,%0A  
@@ -1047,16 +1047,17 @@
 stage-0'
+,
 %0A       
@@ -1089,32 +1089,33 @@
 ternal-helpers'%5D
+,
 %0A      %7D)%0A    %5D%0A
@@ -1103,30 +1103,32 @@
 '%5D,%0A      %7D)
+,
 %0A    %5D
+,
 %0A  %7D,%0A%0A  // 
@@ -1602,16 +1602,17 @@
 : 'es' %7D
+,
 %0A    %5D,%0A
@@ -1702,24 +1702,25 @@
 _modules/**'
+,
 %0A        %5D,%0A
@@ -1777,16 +1777,17 @@
 -es6/**'
+,
 %0A       
@@ -1967,16 +1967,17 @@
 render'%5D
+,
 %0A       
@@ -1974,24 +1974,25 @@
 %5D,%0A        %7D
+,
 %0A      %7D),%0A 
@@ -2097,15 +2097,15 @@
     
-%22
+'
 react
-%22
+'
 ,%0A  
@@ -2130,16 +2130,16 @@
     
-%22
+'
 latest
-%22
+'
 ,%0A  
@@ -2168,16 +2168,16 @@
     
-%22
+'
 es2015
-%22
+'
 : %7B%0A
@@ -2196,24 +2196,25 @@
     
-%22
+'
 modules
-%22
+'
 : false
+,
 %0A   
@@ -2217,32 +2217,33 @@
 %0A              %7D
+,
 %0A            %7D%0A 
@@ -2240,16 +2240,17 @@
        %7D
+,
 %0A       
@@ -2269,17 +2269,18 @@
     
-%22
+'
 stage-0
-%22
+',
 %0A   
@@ -2324,16 +2324,17 @@
 elpers'%5D
+,
 %0A      %7D
@@ -2338,18 +2338,21 @@
   %7D)
+,
 %0A    %5D
+,
 %0A  %7D
+,
 %0A%5D;%0A

Format code