How to load C3JS properly into WebPack?

时光怂恿深爱的人放手 提交于 2019-12-11 05:29:18

问题


I am trying to use C3JS, which is a library based on D3JS in my VUEJS/WebPack project (created from this boilerplate).

I load D3JS by npm installing it and by loading it as a webpack plugin like anything else. However, doing the same for C3JS does not work.

plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery', // <--- This works, I can call this variable anywhere in my JS code
      jQuery: 'jquery', // <--- This works...
      d3: 'd3', // <--- This works...
      c3: 'c3' // <--- This DOES NOT work, I can import c3 but the CSS is not loaded
    })
  ],

I tried to find some pattern but no luck...

For example D3JS has the following folder structure:

While C3JS has the following:

This is D3JS.

This is C3JS.

What am I missing?

Thanks!


回答1:


Since webpack treats everything as a module you can also import 'path/to/c3/style.css. You can also use require syntax as well.



来源:https://stackoverflow.com/questions/37912988/how-to-load-c3js-properly-into-webpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!