I am getting the following error in the browser console when trying to live reload / HMR on Webpack. It occurs after I make a save after a file change.
[HMR] Update failed: Error: Failed to fetch update manifest Internal Server Error
The react app I'm setting up is currently running off port 8000, could this be the reason it's failing?
Interestingly when I have 'writeToDisk: true' set it seems to work, but I get a build up of a ton of hot update js files which clog the source directory so this is not optimal.
I'm sure there is something fairly simple I'm missing. Any help would be fantastic.
Thank you.
Here is my webpack config:
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = function(_env, argv) {
const isProduction = argv.mode === "production";
const isDevelopment = !isProduction;
return {
devtool: isDevelopment && "cheap-module-source-map",
entry: [
"./src/index.js",
"./src/app.scss"
],
output: {
path: path.resolve(__dirname, "../client/assets/"),
filename: "js/main.js",
publicPath: "/"
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
cacheDirectory: true,
cacheCompression: false,
envName: isProduction ? "production" : "development"
}
}
},
{
test: /\.s[ac]ss$/i,
exclude: /node_modules/,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
],
},
]
},
resolve: {
extensions: [".js", ".jsx"]
},
plugins: [
isProduction &&
new MiniCssExtractPlugin({
filename: "main.css",
chunkFilename: "main.chunk.css"
})
].filter(Boolean),
devServer: {
contentBase: path.join(__dirname, "../client/assets/js"),
publicPath: "/",
port: '8080',
compress: true,
hot: true,
// writeToDisk: true,
watchContentBase: true
}
};
};```