import cjs from '@rollup/plugin-commonjs';
import node from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import json from '@rollup/plugin-json';

const production = !process.env.ROLLUP_WATCH;

export default {
    input: 'dist/main.js',
    output: [
        { file: 'script.js', format: 'iife', sourcemap: true, inlineDynamicImports: true }
    ],
    plugins: [
        node({ browser: true }),
        cjs(),
        production && terser(),
        json()
    ],
};