fix: support build cache #371
Merged
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
statictarget.Related issues: #367, #352, #353
This PR mainly fixes #353
When using
nuxt generateand cache hit happens, we skipnuxt buildstep and directly generate. However asbuild:*hooks won't be called anymore (even toughbuildModulesare called!)Attempts to fix
sw.jsis properly emitted (temporary fix)_buildflag exists (nuxt dev,nuxt buildand first optional stage ofnuxt generate) ortargetisstatic. Downside is we call modules twice when cache miss occurs but seems only waybuildModulesare called for generate's second stage builder is not loaded so webpack hook to emit assets andaddTemplatedoes not workKnown issues
iconNuxt 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 fixedmanifestRelying on webpack hook means we can't generate updated manifest (in case icon hash changes)
metaIf meta depending on
process.env, we won't regenerate it as ofaddTemplatebuilder dependencyworkboxsw.jsfile needs to be restored. Instead of 491f440 workaround, we can directly generate template without depending on nuxt builder