'Vue.js historyapifallback not working, Why?

In the development environment, refreshing from /test works fine.

However, when I refresh after deployment, I get a 404 error.

Where is the problem?

vue.config.js

const path = require("path");
module.exports = {
  devServer: {
    overlay: false,
    historyApiFallback: true,
    hot: true,
  },
  transpileDependencies: [
    'element-plus'
  ],
  
  publicPath: '/',
  
  outputDir: path.resolve(__dirname, "./dist"),
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source