Skip to content

Commit

Permalink
edited readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Jun 8, 2019
1 parent fd4442c commit 2340026
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 2340026

Please sign in to comment.