2
votes

I'm a using Vue 2, Webpack, vue-router and Prerender Spa Plugin.

I'm facing an issue when I try to prerender my nested routes.

The plug-in works fine for the routes '/' and '/first-level'.
But when I add a nested routes '/first-level/second-level', the output html is the same as the index.html for the '/' route.

Here is my webpack conf :

enter image description here

Does anyone encoutered the same issue ?

2

2 Answers

0
votes

What is your routing mode? Change your routing mode to history

const router: Router = new Router({
  mode: 'history', 
  routes, 
  scrollBehavior(to, from, savedPosition) { 
    if (savedPosition) { 
      return savedPosition; 
    } else { 
      return { x: 0, y: 0 } 
    } 
  } 
})
0
votes

@Sandwell, I'm not sure its a general problem with the plugin.

I use version ^3.3.0 of the plugin and it works fine here. Though "this" is not an answer, this is just to tell you that its possible using the plugin.

I'd like to help you more if this problem still persists.

Cheers.

enter image description here