Convert the code above to the code below:

        
            devServer: {
                static: path.resolve(__dirname, 'dist'),
                port: 9000
            }
        
    

It's important to set clean to false. It happened to me...

        
            webpackConfig = {
                output: {
                    clean: false
                }
            }
        
    

Use static instead, as contentBase is deprecated in the latest Webpack v5:

        
            devServer: {
                static: {
                    directory: path.join(__dirname, "./")
                }
            }