Answer the question
In order to leave comments, you need to log in
Why webpack-dev-server stopped following/updating changed css after update?
Everything worked well, but after I updated to the fifth webpack , and updated resp. webpack-dev-server, webpack-dev-server stopped following/updating changed css. That is, when the application is running and I change the html in any file, it immediately sees and updates the changes, but if I change the css file, it does not update anything else.
Here is the script from package.json.
I used to have: "start": "webpack-dev-server --mode development --hot" but I read that webpack serve should now be used . I start , as before, with the npm start command.
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack serve --mode development --hot",
"build": "webpack --mode production"
},
"sass": "^1.26.11",
"sass-loader": "^10.0.4",
"style-loader": "^2.0.0",
"webpack": "^5.3.0",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0"
const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
mode: "development",
entry: "./src/index.js",
output: {
path: path.join(__dirname, "/dist"),
filename: "[name].js",
sourceMapFilename: "[name].js.map",
},
devServer: {
contentBase: "/dist",
watchContentBase: true,
open: true,
inline: true,
hot: true,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "sass-loader"],
},
{
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)(\?[a-z0-9=.]+)?$/,
use: [
{
loader: "url-loader",
options: {
limit: 100000,
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html",
}),
],
}
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