Static GitHub Issues

[715] Can't find generated files

prev: How to generate profile.json
next: When routing is switched, the component will be rendered two times

My server framework(total.js) ask me to serve static files in 'public/', and I store nuxt source code in 'nuxt/' here is my nuxt.config.js

module.exports = {
  head: {
    title: 'starter',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', content: "Nuxt.js project" }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
    ]
  },
  loading: { color: '#3B8070' },
  build: {
    publicPath: '/dist'
  },
  srcDir: 'nuxt/',
  rootDir: __dirname,
  generate: {
    dir: 'public/'
  }
}

I call nuxt.build before I use nuxt.render as my middleware

const Nuxt = require('nuxt')
const config = require('../nuxt.config')
const nuxt = new Nuxt(config)

nuxt.build()
  .then(function () {
    F.middleware('nuxt', nuxt.render)
  })

When I restart the server the log says 'Compiled successfully ' but nothing appear in my 'public/' folder. If I run nuxt generate, all the generated files generated in the 'public/' folder, but I still can not get 404 errors after I restart server, because the file names are not match.

How can I generate static files when I am building and match the file names correctly?

<!--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/c612">#c612</a>)</em></sub></div>