I'm trying to get webpack to output a css file for my less instead of inline styles. I've been using the extract-text-webpack-plugin.
I've set it up based on the documentation and have had a look at similar questions on stackoverflow but can't figure out why my below webpack config file is not outputting a file or putting anything in index.html
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
'webpack/hot/only-dev-server',
'./app/main.js'
],
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js?$/,
loaders: ['react-hot', 'babel'],
exclude: /node_modules/
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('style', 'css!less')
//loader: "style!css!less"
}
]
},
plugins: [
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('[name].css', {
allChunks: true
})
]
};
<link href='/dist/main.css' rel='stylesheet' type='text/css'>(the href path would simply be your output.publicPath + [name].css where [name] is your bundle name (in this case main))