How to resolve a css file in bower_components
Hi friends. Please help me with this. I try to use BowerWebpack for looking for bower_components, but it seems get only js file, how about css file. Thanks !
require('select2.css'); //This line is not work
require('select2'); //this line work as expect
Try adding .css to resolve.extensions in your webpack config.
@illicium
I tried extensions: ['', '.webpack.js', '.web.js', '.js', '.css'], but it does not work.
require('select2.css'); //This line for loading css file
require('select2'); //this line automatically load js file
Thanks !
@lovedota BowerWebpackPlugin will try to load all files specified in the component's bower.json main section. select2 references an SCSS stylesheet, but webpack can't load it out of the box -- you'll need to install sass-loader.
Alternatively, you can manually require the precompiled CSS file by specifying the path relative to the bower component:
require('select2/dist/css/select2.css');