import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';

import pkg from './package.json';

const input = 'src/index.js';
const plugins = [
  babel({ exclude: '**/node_modules/**' }),
];

const name = 'ReactStayScrolled';
const globals = { react: 'React' };
const external = id => !id.startsWith('.') && !id.startsWith('/');

export default [{
  external,
  input,
  output: { file: `dist/${pkg.name}.cjs.js`, format: 'cjs' },
  plugins,
}, {
  external,
  input,
  output: { file: `dist/${pkg.name}.esm.js`, format: 'esm' },
  plugins,
}, {
  external: Object.keys(globals),
  input,
  output: {
    file: `dist/${pkg.name}.umd.js`, format: 'umd', globals, name,
  },
  plugins: [
    ...plugins,
    resolve(),
    commonjs(),
    terser(),
  ],
}];

@@ -545,16 +545,34 @@
 t: 'cjs'
+, exports: 'named'
  %7D,%0A  pl
@@ -803,16 +803,34 @@
 s, name,
+ exports: 'named',
 %0A  %7D,%0A  

Fix umd and cjs export names