Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issues with nuxt build cache for
static
target.Related issues: #367, #352, #353
This PR mainly fixes #353
When using
nuxt generate
and cache hit happens, we skipnuxt build
step and directly generate. However asbuild:*
hooks won't be called anymore (even toughbuildModules
are called!)Attempts to fix
sw.js
is properly emitted (temporary fix)_build
flag exists (nuxt dev
,nuxt build
and first optional stage ofnuxt generate
) ortarget
isstatic
. Downside is we call modules twice when cache miss occurs but seems only waybuildModules
are called for generate's second stage builder is not loaded so webpack hook to emit assets andaddTemplate
does not workKnown issues
icon
Nuxt does not checks
static/
dir (static/icon.png
) for build cache. This means if icon is updated, module wasn't being called. By always running module this should be fixedmanifest
Relying on webpack hook means we can't generate updated manifest (in case icon hash changes)
meta
If meta depending on
process.env
, we won't regenerate it as ofaddTemplate
builder dependencyworkbox
sw.js
file needs to be restored. Instead of 491f440 workaround, we can directly generate template without depending on nuxt builder