I created an application using create-react-app. I am using CSS modules by configuring webpack files. when I use reactstrap Bootstrap classes appears but styling not applying.
Following instructions from https://reactstrap.github.io/
imported CSS in an index.js file too, But style not applying.
{
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
},
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
],
},
I tried import '!style-loader!css-loader!bootstrap/dist/css/bootstrap.css'; https://github.com/reactstrap/reactstrap/issues/778
But it throws an error.'unexpected symbol !'
Try this:
Import Bootstrap CSS in the src/index.js file: import 'bootstrap/dist/css/bootstrap.min.css';
.
Let me know if that helps.
I solved problem by using Bootstrap CSS as CDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With