问题
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