import json from '@rollup/plugin-json'
import { terser } from 'rollup-plugin-terser'
import livereload from 'rollup-plugin-livereload'
import serve from 'rollup-plugin-serve'

const production = !process.env.ROLLUP_WATCH

export default {
  input: 'src/index.js',
  output: {
    sourcemap: true,
    format: 'es',
    file: production ? 'dist/zero-md.min.js' : 'test/build/bundle.js'
  },
  plugins: [
    json(),
    !production && serve({
      port: 5000,
      contentBase: ['test', '']
    }),
    !production && livereload({
      watch: ['test', 'docs'],
      extraExts: ['.md']
    }),
    production && terser()
  ],
  watch: {
    clearScreen: false
  }
}

@@ -32,16 +32,154 @@
 n-json'%0A
+import babel from '@rollup/plugin-babel'%0Aimport resolve from '@rollup/plugin-node-resolve'%0Aimport commonjs from '@rollup/plugin-commonjs'%0A
 import %7B
@@ -357,22 +357,21 @@
 CH%0A%0A
-export default
+const build =
  %7B%0A 
@@ -459,43 +459,473 @@
 le: 
-production ? 'dist/zero-md.min.js' 
+'dist/zero-md.min.js'%0A  %7D,%0A  plugins: %5B%0A    json(),%0A    resolve(),%0A    terser()%0A  %5D%0A%7D%0A%0Aconst buildLegacy = %7B%0A  input: 'src/index.js',%0A  output: %7B%0A    sourcemap: true,%0A    format: 'iife',%0A    name: 'ZeroMd',%0A    file: 'dist/zero-md.legacy.min.js'%0A  %7D,%0A  plugins: %5B%0A    json(),%0A    resolve(),%0A    babel(%7B babelHelpers: 'bundled' %7D),%0A    commonjs(),%0A    terser()%0A  %5D%0A%7D%0A%0Aconst dev = %7B%0A  input: 'src/index.js',%0A  output: %7B%0A    sourcemap: true,%0A    format: 'es',%0A    file
 : 't
@@ -971,24 +971,39 @@
     json(),%0A
+    resolve(),%0A
     !product
@@ -1135,16 +1135,24 @@
 , 'docs'
+, 'dist'
 %5D,%0A     
@@ -1181,36 +1181,8 @@
   %7D)
-,%0A    production && terser()
 %0A  %5D
@@ -1223,8 +1223,64 @@
 e%0A  %7D%0A%7D%0A
+%0Aexport default production ? %5Bbuild, buildLegacy%5D : dev%0A

Add legacy build