A minor problem with webpack

  node.js, question

Recently, I have been learning to use webpack again, and I have also tried to combine my project with webpack.
After reading many tutorials, I finally succeeded in building it.
Later, i tried to further configure webpack-dev-server, and finally i was able to hot deploy module.
However, in the end there is still a little problem that is not very clear. It is about webpack-dev-middleware. What is the use of this middleware? Does it mean that if I use middleware in my current express project, I don’t need to start an additional webpack server?
If the port started by express is 8081 and the default port of Web Pack-Dev-Server is 8080, then after I used middleware in the project, the original meaning of localhost: 8080/{publicpath}/{module}. js changed to localhost: 8081/{publicpath}/{module}. js?
I just tried it, it’s 404, so how does this middleware work?


output: {
 libraryTarget: 'var',
 filename: '[name].build.js',
 chunkFilename: '[chunkhash:8].[name].chunk.js',
 publicPath: '/public/assets/',
 path: path.join(__dirname, '/public/assets')

Express middleware part

var app = express();
 var webpackDevMiddleware = require('webpack-dev-middleware');
 var webpack = require('webpack');
 var webpackConf = require('./webpack.config');
 contentBase: webpackConf.output.path,
 publicPath: webpackConf.output.publicPath,
 hot: true,
 stats: {
 colors: true

Resolved, path conflict, local resource loaded first.