I'm using webpack v4 and I'm trying to use Pug
with webpack-dev-server
but when I run webpack-dev-server --mode development
it doesn't serve compiled Pug
. Please, help. I don't know what to do. Thanks for reply. Here is my config:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/js/main.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.pug$/,
use: {
loader: 'pug-loader',
options: {
pretty: true
}
}
}
]
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
hot: true,
open: true,
progress: true
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src/templates/pages/index.pug'),
inject: false
})
]
};