import externalDependencies from '@azimutlabs/rollup-plugin-external';
import copy from 'rollup-plugin-copy';

export default [
  {
    input: 'main.js',
    output: [{ file: 'dist/main.js', format: 'cjs' }],
    plugins: [
      externalDependencies(),
      copy({
        targets: [
          { src: ['**/*.js'], dest: 'dist' },
          { src: ['**/*.html'], dest: 'dist' },
          { src: 'package.json', dest: 'dist' },
          { src: 'README.md', dest: 'dist' },
        ],
        flatten: false,
      }),
    ],

    // exclude externalDependencies' flags
    external: (id) => id.includes('fp-ts'),
  },
];
