FinnM
FinnM

Reputation: 411

webpack bootstrap-loader will emit bootstrap.js but not bootstrap.css file?

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 :

Upvotes: 0

Views: 268

Answers (1)

FinnM
FinnM

Reputation: 411

Solution - I set the extractStyles variable in the .bootstraprc to true. I can now sleep with peace.

Upvotes: 0

Related Questions