我在 Localhost 开发的时候会出现一个错误讯息困扰有许久,而且是机率性的。因为以 SPA(Single-Page Application) 开发专案项目时会遇到 SEO 问题,于是我透过 prerender-spa-plugin 来解决这个问题,于是乎遇到了以下错误:
[prerender-spa-plugin] Unable to prerender all routes!
解决方法也很简单,只要在 vue.config.js 多加一个 headless: true 参数就可以了
vue.config.js
headless: true
终于不会再看到那扰人的错误赤字
原文出处
https://ianakaberlin.medium.com/vue-%E5%9C%A8-run-build-%E6%99%82%E5%87%BA%E7%8F%BE-prerender-spa-plugin-unable-to-prerender-all-routes-%E9%8C%AF%E8%AA%A4%E8%A7%A3%E6%B1%BA%E6%96%B9%E5%BC%8F-%E4%BC%8A%E6%81%A9%E8%B8%A9%E5%9D%91%E7%AD%86%E8%A8%98-ed5a678e8ae5