Reputation: 411
In a nutshell, I am trying to output my css assets using the extract-text-webpack-plugin
. I would expect that the bootstrap loader would spit out a bootstrap.css
but this is not the case. I'm thinking I might have to add a include 'webpack-loader/path/to/css'
in my app.js
, but something about that feels chintzy and against the purpose of webpack.
Below is the most minimal webpack.config.js
I can create that represents the issue. The configuration assumes that the webpack.bootstrap.config.js
and .bootstraprc
files are located in the same directory as the webpack.config.js
const path = require("path");
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const bootstrapEntryPoints = require('./webpack.bootstrap.config');
const extractCssPlugin = new ExtractTextPlugin({
filename : '[name].css'
});
module.exports = {
entry : {
app : "./src/js/app.js",
bootstrap : bootstrapEntryPoints.dev
},
output : {
path : path.resolve(__dirname, 'dist'),
filename : "[name].bundle.js"
},
module : {
rules : [
{ test: /\.css$/, use : extractCssPlugin.extract({use : [{loader: "css-loader"}]})},
{ test: /\.(woff2?|svg)$/, loader: 'url-loader?limit=10000' },
{ test: /\.(ttf|eot)$/, loader: 'file-loader' },
]
},
devServer : {
contentBase : path.join(__dirname, "dist"),
hot : true,
},
plugins : [
extractCssPlugin,
],
};
NOTES :
bootstrapEntryPoints.dev
resolves to 'bootstrap-loader'
. Meaning that my bootstrap entry point looks like entry : {..., bootstrap : 'bootstrap-loader'}
Upvotes: 0
Views: 268
Reputation: 411
Solution - I set the extractStyles
variable in the .bootstraprc
to true
. I can now sleep with peace.
Upvotes: 0