import { nodeResolve } from '@rollup/plugin-node-resolve'; import terser from '@rollup/plugin-terser'; import { execSync } from 'child_process'; // Simple copy plugin to auto-copy to demo-site during development function copyToDemo() { return { name: 'copy-to-demo', writeBundle() { try { execSync('cp dist/insertr.js ../demo-site/insertr.js'); console.log('📄 Copied to demo-site/insertr.js'); } catch (error) { console.warn('⚠️ Failed to copy to demo-site:', error.message); } } }; } export default [ // Development build { input: 'src/index.js', output: { file: 'dist/insertr.js', format: 'iife', name: 'Insertr' }, plugins: [ nodeResolve(), copyToDemo() ] }, // Production build (minified) { input: 'src/index.js', output: { file: 'dist/insertr.min.js', format: 'iife', name: 'Insertr' }, plugins: [ nodeResolve(), terser() ] } ];