I have implemented the prerender-spa-plugin in my Vue Webpack Cli project following the documentation by registering the Plugin in webpack.prod.conf.js as shown below:
...
plugins: [
...
new PrerenderSpaPlugin(
path.join(__dirname, '../dist'),
['/', '/about', '/contact'],
{
captureAfterTime: 5000
}
)
]
Now, I am exploring the possibility of retrieving the list of routes array via an axios call. However, my attempts so far have been unsuccessful as illustrated in the code snippet below:
var routes = axios.get('http://myapi.com/api').then(function (response) {
return response.map(function (response) {
return '/base/' + response.slug
})
})
plugins: [
...
new PrerenderSpaPlugin(
path.join(__dirname, '../dist'),
routes,
{
captureAfterTime: 5000
}
)
]
Due to my limited Javascript knowledge, I am struggling to resolve this issue. Any guidance or insights on how to achieve this would be greatly appreciated.
Best regards