
// import angular from 'rollup-plugin-angular';
import commonjs from 'rollup-plugin-commonjs';
import html from 'rollup-plugin-html';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';

export default {
  entry: 'dist/index.js',
  dest: 'dist/bundle.umd.js',
  exports: 'named',
  sourceMap: false,
  format: 'umd',
  moduleName: '@ngx-markdown/core',
  onwarn,
  plugins: [
    commonjs(),
    html({
      include: '**/*.html',
      htmlMinifierOptions: {
        caseSensitive: true // need to do not lower letter
      }
    }),
    nodeResolve({
      // use "es2015" field for ES2015 modules with ES2015 code,
	    // if possible
      es2015: true, // Default: false

      // use "module" field for ES2015 modules with ES5 code,
      // if possible
      module: true, // Default: true

      // use "jsnext:main" if possible
      // – see https://github.com/rollup/rollup/wiki/jsnext:main
      jsnext: true,  // Default: false

      // use "main" field or index.js, even if it's not an ES6 module
      // (needs to be converted from CommonJS to ES6
      // – see https://github.com/rollup/rollup-plugin-commonjs
      main: true,  // Default: true

      extensions: [ '.js', '.json' ]
    }),
    typescript({
      typescript: require('./node_modules/typescript')
    }),
    uglify({}, minify)
  ]
};

function onwarn(message) {
  const suppressed = [
    'UNRESOLVED_IMPORT',
    'THIS_IS_UNDEFINED'
  ];

  if (!suppressed.find(code => message.code === code)) {
    return console.warn(message.message);
  }
}

@@ -1,8 +1,4 @@
-%0A// 
 impo
@@ -38,16 +38,16 @@
 gular';%0A
+
 import c
@@ -85,16 +85,19 @@
 monjs';%0A
+// 
 import h
@@ -127,16 +127,16 @@
 -html';%0A
-
 import n
@@ -275,16 +275,19 @@
 glify';%0A
+// 
 import %7B
@@ -314,16 +314,16 @@
 fy-es';%0A
-
 %0Aexport 
@@ -512,146 +512,97 @@
     
-commonjs(),%0A    html(%7B%0A      include: '**/*.html',%0A      htmlMinifierOptions: %7B%0A        caseSensitive: true // need to do not lower letter
+angular(),%0A    commonjs(%7B%0A      namedExports: %7B%0A        'node_modules/rxjs/**': %5B'named'%5D
 %0A   
@@ -1385,18 +1385,8 @@
 ify(
-%7B%7D, minify
 )%0A  

remove html plugin, use angular, remove uglify-es