xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.09k stars 192 forks source link

issue with rollup #5

Closed debuggerpk closed 7 years ago

debuggerpk commented 7 years ago

when doing a rollup, it gives me.

'AngularEchartsModule' is not exported by node_modules/ngx-echarts/bundles/ngx-echarts.umd.js

my rollup.config.js is

import angular from 'rollup-plugin-angular';
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import sass from 'node-sass';
import CleanCSS from 'clean-css';
import {
  minify as minifyHtml
} from 'html-minifier';
import uglify from 'rollup-plugin-uglify';

const cssmin = new CleanCSS();
const htmlminOpts = {
  caseSensitive: true,
};

export default {
  entry: 'src/main.ts',
  format: 'iife',
  dest: 'dist/bundle.js',
  plugins: [
    commonjs({
      include: 'node_modules/rxjs/**',
    }),
    angular({
      preprocessors: {
        template: template => minifyHtml(template, {
          collapseWhitespace: true,
          removeComments: true
        }),
        styleUrls: scss => {
          const css = sass.renderSync({
            data: scss
          }).css;
          return cssmin.minify(css).styles;
        }
      }
    }),
    typescript(),
    nodeResolve({
      jsnext: true,
      main: true
    }),
    uglify({
      toplevel: true,
      compress: {
        dead_code: true,
        sequences: true,
        unused: true,
        if_return: true,
        drop_console: true,
        drop_debugger: true,
        passes: 2
      }
    })
  ]
}
xieziyu commented 7 years ago

Try to add ngx-echarts path in your rollup's commonjs plugin

debuggerpk commented 7 years ago

thanks. I update my config to

    commonjs({
      include: [
        'node_modules/rxjs/**',
        'node_modules/ngx-echarts/**',
        'node_modules/angular2-jwt/angular2-jwt.js'
      ]
    }),

and it is working now.

//ysf