text: import svelte from 'rollup-plugin-svelte';
  import resolve from '@rollup/plugin-node-resolve';
  import commonjs from '@rollup/plugin-commonjs';
  import livereload from 'rollup-plugin-livereload';
  
  function serve() {
  	let server;
  	
  	function toExit() {
  		if (server) server.kill(0);
  	}
  
  	return {
  		writeBundle() {
  			if (server) return;
  			server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
  				stdio: ['ignore', 'inherit', 'inherit'],
  				shell: true
  			});
  
  			process.on('SIGTERM', toExit);
  			process.on('exit', toExit);
  		}
  	};
  }
  
  export default {
  	input: 'main.js',
  	output: {
  		sourcemap: true,
  		format: 'iife',
  		name: 'app',
  		file: 'public/build/bundle.js'
  	},
  	plugins: [
  		svelte({
  			dev: true,
  			css: css => {
  				css.write('bundle.css');
  			}
  		}),
  		resolve({
  			browser: true,
  			dedupe: ['svelte']
  		}),
  		commonjs(),
  		serve(),
  		livereload('public')
  	],
  	watch: {
  		clearScreen: false
  	}
  };