VueJS and Firebase, history 404 update error

I removed hashbang in the history mode link in my router file. Now, when I refresh the page, I got a 404 error.

I tried to follow this link

then I added the part in firebase.json:

{
  "hosting": {
    "public": "dist",
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

however, nothing has changed.

I do not understand why I still have this error. I have tried many things, but I can not find something to fix it.

This is my router file:

const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/catalog'
    },
    {
      path: '/catalog',
      name: 'Catalog',
      component: Catalog
    },
    {
      path: '/catalog/category/:category',
      name: 'ProductsList',
      component: ProductsList
    },
    {
      path: '/catalog/category/:category/product/:id',
      name: 'ProductDetail',
      component: ProductDetail,
    },
    {
      path: '/catalog/category/:category/product/create',
      name: 'CreateProduct',
      component: CreateProduct
    }
  ]
});
+4
source share

Source: https://habr.com/ru/post/1689244/


All Articles