import esbuild from 'esbuild';
import dtsPlugin from 'esbuild-plugin-d.ts';

const settings = {
  entryPoints: ['src/index.ts'],
  bundle: true,
  sourcemap: true,
  plugins: [
    // dtsPlugin()
  ],
  external: [
    '@netless/forge-room',
    'yjs',
    'eventemitter3',
    'uuid',
  ],
};

esbuild.build({
  ...settings,
  outfile: 'dist/index.js',
  platform: 'browser',
  format: 'cjs',
}).then(console.log).catch(console.log);

esbuild.build({
  ...settings,
  outfile: 'dist/index.esm.js',
  platform: 'browser',
  format: 'esm',
}).then(console.log).catch(console.log);
