Sai Srinivasan

FusionCharts.register is not a function when bundling with WebPack

Recommended Posts

I'm developing an Angular 2 application and using webpack to bundle my application together. One of my components imports the fusioncharts library stored in /lib/fusioncharts directory in the root of my project.

Note: I dont have the fusioncharts module in node_modules.

I was able to configure my aliases, provide plugin correctly (the bundle increased in size, and I was able to verify, through the network tab that fusion charts existed):

import statement:

import FusionCharts from 'fusioncharts'

alias statement:

'fusioncharts' : '/lib/fusioncharts/fusioncharts.js'

provide plugin:

  new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  'window.jQuery': 'jquery',
  'window.PR': 'prettify',
  FusionCharts: 'fusioncharts',

This lead to my bundle increasing in size, and in the network tab, I was able to locate my fusioncharts code.

Webpack didnt throw any errors during the build, but when I launched my application, I received this in my browser console:

Screen Shot 2018-05-25 at 10.43.01 AM.png

Screen Shot 2018-05-24 at 11.25.45 PM.png

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now