The Vue project is packaged and deployed to tomcat, and an Error 404 is reported as soon as it is refreshed

The reason is that the history mode is used   HTML5 history mode | Vue router

I didn’t find a solution

So we changed the routing to hash mode

I use cli3

It was

import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),

Change to

import {createRouter, createWebHashHistory} from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),

It’s normal after modification

Read More: