extend is not a function (v 2.7.0)

Hi, we’re using ng2-charts (v 1.6.0) which has dependency on chart.js
Everything was working fine – that is, until the last release.
Now we’re getting

    TypeError: uF.extend is not a function
    at core.element.js:61
    at main-aot.js:3

The problem occurs with AoT build using rollup.
Rollup config:

import rollup      from 'rollup';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs    from 'rollup-plugin-commonjs';
import uglify      from 'rollup-plugin-uglify';
import includePaths from 'rollup-plugin-includepaths';

export default {
    entry: '../ClientApp/account/dashboard/main-aot.js',
    dest: '../ClientApp/account/dashboard/bundle.js',
    sourceMap: true,    
    format: 'iife',
    plugins: [
        includePaths({
        include: {},
        paths: ['../ClientApp'],
        external: [],
        extensions: ['.js']
    }),
        nodeResolve({jsnext: true, module: true}),
        commonjs({
            include: [
                '../node_modules/rxjs/**', 
                '../node_modules/email-addresses-custom/lib/**', 
                '../node_modules/jstz-custom/**', 				
                '../node_modules/rxjs/**',				
                '../node_modules/chart.js/**',
                '../node_modules/chartjs-color/**',
                '../node_modules/chartjs-color-string/**',
                '../node_modules/color-convert/**',
                '../node_modules/color-name/**',
                '../node_modules/ng2-charts/**'          
            ],
            namedExports: {
                '../node_modules/chart.js/dist/Chart.js': ['chart.js'],
                '../node_modules/ng2-charts/ng2-charts.js': ['ChartsModule']
            }
        }),
        uglify()
    ]
}

Environment

  • Chart.js version: 2.7.0
  • Browser name and version: Chrome 60.0.3112

I am not sure whether is it problem with chart.js or just rollup config.

Author: Fantashit

1 thought on “extend is not a function (v 2.7.0)

  1. @imranmomin – for the time being, we’re just using older version of chart.js – replacing whole folders of chart.js, chartjs-color and chartjs-color-string in node_modules (not so sure about necessity of replacing the last two, but it doesn’t hurt)

    It’s far from ideal though..

Comments are closed.