Static GitHub Issues

[2928] nuxt generate --watch

prev: mac 上安装完nuxt 后报错,麻烦谁给解决下
next: SyntaxError: Unexpected token ...

I know that issue #52 exists, but I'm not sure if it's a good idea to add a comment there.

I stumbled over this because I think the nuxt generate --watch command is what I need. I'm creating a static site/blog using Nuxt. I create a page for every blog post using the config property generate.routes. (there I create a route for every .md file in another folder in the project) There I pass all data I need to the page's asyncData method via payload.

Now this works fine if I use nuxt generate. But if I just use nuxt (which is just way more useful while development) the payload parameter is undefined. As far as I understand it only get's passed in the generate process because that's the only time that generate.routes gets processed.

Now the obvious solution would be nuxt generate --watch ‒ if it was a thing. I figured that I can also fetch the blog post's content inside the asyncData method. But it feels like I'm doing the work twice. Also this makes me wonder what's the point of the payload parameter.

Since generating static pages for e. g. GitHub Pages is officially supported this doesn't feel like an edge case to me. Or what do you think? Are there other solutions to this problem?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2542">#c2542</a>)</em></sub></div>