I have been learning webpack for use in a Single Page App.
One of the examples is using:
import 'bootstrap/dist/css/bootstrap.min.css';
along with a loader like this:
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
This works to inject bootstrap css into main.js and it then gets injected into the dom at runtime.
Ok fine. But why? I don't see a benefit to this over just have a normal link.
The other side of the code is that this is now increasing the size of the bundle (my app bundle is already over 5 megs) is just going to increase the startup time vs using a CDN.
Am I missing anything?
Update
I think I found the answer to this: The next step is to extract the imported css to a css file with MiniCssExtractPlugin like explained here