Hashnode / mern-starter

⛔️ DEPRECATED - Boilerplate for getting started with MERN stack
MIT License
5.16k stars 1.18k forks source link

How to integrate Reactstrap into mern-starter #406

Open chung2014 opened 6 years ago

chung2014 commented 6 years ago

I would like to use reactstrap with this mern-starter. But I find that I cannot start the project with npm start properly after I add an import statment in client/modules/App/App.js e.g import 'bootstrap/dist/css/bootstrap.css';

theevilhead commented 6 years ago

Hey @chung2014, I think the error you are getting is related to webpack loader. It just needs to be loaded no need to complie it.

Add the below to webpack.config.babel.js just like in the image below for now and use minified version import 'bootstrap/dist/css/bootstrap.min.css';

If you want to customize the use of bootstrap in your project I think its better to follow bootstrap guide to importing styles/compile sass for that this change will not be needed https://getbootstrap.com/docs/4.0/getting-started/webpack/

{
        test: /\.min.css$/,
        use: ['style-loader', 'css-loader']
},
screen shot 2018-12-04 at 3 34 57 pm
chung2014 commented 6 years ago

@theevilhead Yes, working with webpack settings is complex. And your suggest works. After adding the snippet into webpack.config.babel.js, I can run npm run start without error. How about if I run npm run build or npm run build:server, do I need to change my webpack config files for those environment as well?

chung2014 commented 6 years ago

@theevilhead After I check the webpack config files, I found that all webpack.config.(dev|prod|server).js contain the code snippet you suggested, so why it is the case that only webpack.config.babel.js doesn't contains it. Should all 4 config file be same?

Btw, I just want to know what is the intent behind. thank 🤓

theevilhead commented 5 years ago

Hey @chung2014 sorry for the delay in reply. Glad the suggestion works and I cannot be of more help here because my involvement with project has started recently, so I think the original contributors might have missed it but I dont know the exact intent though.