Repository nuxt-generate-cluster


mvaneijgen posted a new question

nuxt-generate-cluster • 2 months ago

Setting base: in the generate: {} object

I am building an app to host on Github Pages so I changed my generate object in nux.config.js to

generate: {
    dir: 'docs',
    router: {
      base: '/<repo-name>/',

but it seems not possible to change the router with this when running npm run generate. What would be the correct way if setting this?

I still want to use npm run dev and have the app just run locally (localhost:3000) and use npm run generate and host it on Github Pages.


jhpmatos posted a new question

nuxt-generate-cluster • 2 months ago

Task stops if callback is passed

When passing a callback to routes(callback, params). It works with only params: routes(params)


emdahlstrom posted a new question

nuxt-generate-cluster • 3 months ago

All workers complete their work and exit but build silently halts

I have trouble with the build/generation not finishing. The process seems to go fine and all workers complete their work and exit but then nothing happens. Maybe everything is done, just that npm doesn't exit the script.

Has anyone else run into this? Any tips for debugging this?

Here is the generate config from nuxt.config.js:

  generate: {
    workers: 4,
    workerConcurrency: 500,
    concurrency: 500,
    routes: function () {
      return axios.get('https://_-redacted-_/wp-json/wp/v2/posts?per_page=100')
      .then((res) => {
        return => {
          return '/posts/' + post.slug
    done ({ duration, errors, workerInfo }) {
      if (errors.length) {
        console.log({ generate_errors: errors })

pimlie resolved the question #c1

nuxt-generate-cluster • 5 months ago

Should we rename this package

fyi, after careful consideration I changed my mind and dont think we should rename this package 👺

Using child_process directly will not give any major benefits above using the cluster api. And although it maybe feels/sounds a bit wrong to use cluster (at least to me) as thats primarly focussed on networking, there is nothing wrong with using it anyway:

Also the name nuxt-generate-workers might be interpreted as that the package should be used next to another package (that provides the master) so lets keep it as it is


jameswragg posted a new question

nuxt-generate-cluster • 8 months ago

[Question] Generating static sites on-demand with Nuxt.js

Cross-post from nuxt.js/issues/#2370 but this repo also seems applicable…

Hi, I'm trying to create a static-site on-demand API using hapi.js to power the API & nuxt.js as the static-site generator but hitting some blockers….

Here's my setup:

  1. The API takes a POST payload
  2. Based on the payload the API dynamically creates the generate.routes array (passing payloads in for each route)
  3. Calls generate() to create the static site in ./dist


This API is potentially going to be hammered - building a lot of individual content pages and pushing them to S3 buckets. All generated sites going to the ./dist directory is a problem - I currently have an isGenerating flag to prevent multiple generate calls, forcing the client to re-try the API.

  1. Is using Nuxt as a static-site generator on-demand a ridiculous idea?
  2. If (hopefully) not, are there ways of managing the output better. Potentially streaming straight to an S3 bucket?
  3. Should the generator be able to handle parallel builds?

Thanks in advance,


pimlie posted a new question

nuxt-generate-cluster • 10 months ago

Should we rename this package

@Atinux @pi0

When I created this package I used the name cluster as I thought it didnt matter much as it would be a temporary package anyway. That would leave the option open for you to create a package with similar functionality but with a better name. Now that you accepted this package to the nuxt-community, could/should we maybe rename it to e.g. a more suitable nuxt-multi-generate or nuxt-generator-workers name? (better suggestions are welcome)

Also I implemented a cleaner and extensible producer/consumer design in my next branch. I am not sure yet if using cluster is the best in the long run, eg using process/child_process would be 'cleaner'.
Besides that I am thinking about creating a nuxt-generate-daemon that just runs all the time and will poll every interval the routes api endpoint to check for new routes/files to (re)generate. So instead of running this package in a crontab. As I will probably need different type of workers for that I am not sure yet cluster will be sufficient for that. With the new implementation we should be able to easily extend and implement process/subprocess if needed.

So maybe it would be an idea to remove the cluster part from this package name now the impact of that would be still small as there are not many users yet?