diff --git a/README.md b/README.md index 1b63181..447f83e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ My website is going to have thousands of posts! Nuxt will have hard time generat Nuxt can build a portion of a site at one time through `--no-build` flag with `generate` command. When `--no-build` flag is set, Nuxt doesn’t generate common assets such as js, css files, only generates the routes(pages) passed through `generate.routes` in `nuxt.config`. -However, `--no-build` flag assumes that there was previous build before, (`nuxt build`, or `nuxt generate` without no build flag ran before.) because Nuxt needs to let newly generated page know about the common assets. Based on the error Nuxt throws ` ✖ Nuxt Fatal Error: ENOENT: no such file or directory, stat '/Users/hjo/Documents/aclu/nuxt-incremental-build/.nuxt/dist/client'`, Nuxt seems to check the previous build by checking if the files from the previous build exist in expected path. +However, `--no-build` flag assumes that there was previous build before, (`nuxt build`, or `nuxt generate` without no build flag ran before.) because Nuxt needs to let newly generated page know about the common assets. Based on the error Nuxt throws ` ✖ Nuxt Fatal Error: ENOENT: no such file or directory, stat './.nuxt/dist/client'`, Nuxt seems to check the previous build by checking if the files from the previous build exist in expected path. Netlify runs every deploy as a clean build. There is no trace of previous build when new deploy kicks in. So if `nuxt generate --no-build` runs in Netlify environment, Nuxt will throw an error that it cannot find the previous build info. However, it turns out that there is a known-secret, one folder that persists through the builds! which is : `/opt/build/cache` . (This is not a documented feature, but it is there, believe me!) So I decided to move the data that I need for next build to this cache folder after each build, and move those data back to expected path before each build.