Answer the question
In order to leave comments, you need to log in
Why doesn't liveReload work in webpack 4?
Hello. LiveReload does not fire when changing style and markup files.
package.json:
{
"devDependencies": {
"@babel/core": "^7.5.0",
"autoprefixer": "^9.6.1",
"babel-loader": "^8.0.6",
"babel-preset-env ": "^1.7.0",
"css-loader": "^3.0.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.7 .0",
"node-sass": "^4.12.0",
"postcss-loader": "^3.0.0",
"pug": "^2.0.4",
"pug-loader": "^2.4 .0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.35.2",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "^3.7.2"
}
}
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/autoload.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test : /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.(sa|sc|c)ss$/,
use: [
'style- loader',
{
loader: MiniCssExtractPlugin.
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test: /\.pug$/,
loader: 'pug-loader'
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
new HtmlWebpackPlugin({
inject: false,
template: './src/pages/index.pug'
})
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question