Skip to content

Commit

Permalink
perf: calculate asset hash when required (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Mar 22, 2023
1 parent b45f1fa commit c73c7c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/options.ts
Expand Up @@ -161,7 +161,13 @@ export async function resolveOptions(options: Partial<VitePWAOptions>, viteConfi
buildBase: buildBase ?? basePath,
}

await configureStaticAssets(resolvedVitePWAOptions, viteConfig)
// calculate hash only when required
const calculateHash = !resolvedVitePWAOptions.disable
&& resolvedVitePWAOptions.manifest
&& (viteConfig.command === 'build' || resolvedVitePWAOptions.devOptions.enabled)

if (calculateHash)
await configureStaticAssets(resolvedVitePWAOptions, viteConfig)

return resolvedVitePWAOptions
}

0 comments on commit c73c7c0

Please sign in to comment.