text: import typescript from 'rollup-plugin-typescript2';
  import commonjs from 'rollup-plugin-commonjs';
  import nodeResolve from 'rollup-plugin-node-resolve';
  import babel from 'rollup-plugin-babel';
  import { terser } from 'rollup-plugin-terser';
  import serve from 'rollup-plugin-serve';
  import json from '@rollup/plugin-json';
  import * as fs from 'fs';
  
  const dev = process.env.ROLLUP_WATCH;
  
  const serveOpts = {
    contentBase: ['./dist'],
    host: '0.0.0.0',
    port: 5000,
    allowCrossOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    https: {
      key: fs.readFileSync('/.ssl/knott_life_2020_key.pem'),
      cert: fs.readFileSync('/.ssl/knott_life_2020_cer.pem'),
      ca: fs.readFileSync('/.ssl/knott_life_2020_cer_chain.pem'),
    },
  };
  
  const plugins = [
    nodeResolve({ jsnext: true, main: true }),
    commonjs(),
    typescript(),
    json(),
    babel({
      exclude: 'node_modules/**',
    }),
    dev && serve(serveOpts),
    !dev && terser(),
  ];
  
  export default [
    {
      input: 'src/enhanced-templates-card.ts',
      output: {
        file: `./dist/enhanced-templates-card${dev ? '-dev' : ''}.js`,
        format: 'es',
      },
      plugins: [...plugins],
    },
  ];
  