Old files are being served in dev mode, restarting server, clearing cache does not help
I can literally delete all app files, wait for recompile, shut down the server, start the server, go to the url and the app loads like I didn't delete nothing - what's going on?
Some info:
- Version used was 1.12.*
- Starting the server with
babel-node server.js
Webpack config -
// @flow
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// Root path
const root = path.resolve(__dirname, './');
module.exports = {
mode: 'development',
context: `${root}/src`,
entry: {
qorus: [`${root}/src/index.jsx`],
},
output: {
path: `${root}/dist`,
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
publicPath: '/',
},
resolve: {
modules: [`${root}/src/js`, 'node_modules'],
extensions: ['.js', '.jsx'],
},
cache: false,
devtool: 'eval-source-map',
module: {
rules: [
{
test: /\.js(x)?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.(html|mp3|ttf|woff|woff2|eot|svg)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
{
test: /\.(c|sc)ss$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/base.css',
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new webpack.ProvidePlugin({
Promise:
'imports-loader?this=>global!exports-loader?global.Promise!es6-promise',
fetch:
'imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch',
}),
new webpack.NoEmitOnErrorsPlugin(),
],
};
Server config
// @flow
const express = require('express');
const history = require('connect-history-api-fallback');
const serveStatic = require('serve-static');
const config = require('./webpack.config');
const devConfig = require('./webpack.config/dev');
const serverConfig = require('./server_config');
const WebpackDevServer = require('webpack-dev-server');
const proxyMiddleware = require('http-proxy-middleware');
const app = express();
const env = app.get('env');
if (env === 'production') {
app.use(history());
app.get('*', serveStatic(config.output.path));
} else {
// Get webpack
const APIconfig = require('./server_config.js');
const webpack = require('webpack');
// Get the webpack compiler
const compiler = webpack(config);
app.use((req, res, next) => {
const router = new express.Router();
router.use(proxyMiddleware(APIconfig.restBaseUrl));
router.use(proxyMiddleware(APIconfig.extensionProxy));
router.use(proxyMiddleware(APIconfig.dbProxy));
router.use(proxyMiddleware(`${APIconfig.wsBaseUrl}/log`));
router.use(proxyMiddleware(`${APIconfig.wsBaseUrl}/apievents`));
router(req, res, next);
});
/* app.use(proxyMiddleware(APIconfig.restBaseUrl));
app.use(
proxyMiddleware('/apievents', {
target: `${APIconfig.wsBaseUrl}/apievents`,
ws: true,
})
);*/
// History
app.use(history());
// Dev server
app.use(
require('webpack-dev-middleware')(compiler, {
contentBase: config.context,
inline: true,
host: process.env.HOST || 'localhost',
port: parseInt(process.env.PORT, 10) || 3000,
historyApiFallback: true,
publicPath: config.output.publicPath,
noInfo: false,
stats: { colors: true },
})
);
// Serving
app.get('*', serveStatic(config.context));
}
// Dev config
const dConfig = devConfig();
app.listen(dConfig.port, dConfig.host, () => {
process.stdout.write(
`Qorus Webapp ${app.get('env')} server listening on ` +
`http://${serverConfig.host}:${serverConfig.port}\n`
);
});
Please help
- Webpack does complain about missing files but the app works in the browser which means the bundle is cached somewhere who knows where

I'm closing on 35 hours on SOLELY this issue, please any help is appreciated. I've tried everything i've found on the net, restarting computer, but NOTHING is making webpack-dev-middleware serve latest files.
- Upgraded to 3.50
- Tried everything in this massive thread - https://github.com/webpack/webpack-dev-server/issues/875
- Tried various server modifications - serving index.html directly, adding
.invalidate()...
I can see in webpack that the latest js bundle is there. It's just not being served.
Nothing is helping, how can a file stay in memory after a mac restart?
Is there a .cache folder I can delete or something?
Please create minimum reproducible test repo
Most likely browser cache?
This was caused by http-proxy-middleware package, for some reason it was causing wdm to serve some ancient files. All is safe and sound. Sorry for the confusion!
This was caused by
http-proxy-middlewarepackage, for some reason it was causing wdm to serve some ancient files. All is safe and sound. Sorry for the confusion!
So can you give a hint what you did? I am having the same problem.
I ran into this issue a while a go and it turned out to be that there was an error during the build. I missed the error message as it was at the top of the log. Dev server then serves the last successful build
I ran into this and found that it was one of the various caches in node_modules/.cache. Deleting the .cache folder instantly fixed the problem for me.

@Foxhoundn what was the fix?
I had been running dev in yarn and then for whatever absentminded reason was running it in npm one day and kept getting this problem. Switching back to yarn dev did the trick.
I have same problem and I suspect it's caused by browser because of I find it happens on my Eadge rather than Chrome.