Skip to content

resolvePwaConfiguration ​

Function @unplugin-pwa/core/config
ts
resolvePwaConfiguration(pwaOptions: Partial<VitePWAOptions<UserStrategy, T>>, resolverOptions: ResolverOptions): Promise<ResolvedVitePWAOptions<ExtractStrategy<UserStrategy>, T>>

Resolves the PWA configuration based on the provided options and resolver options.

This function will search for the PWA configuration file if the path option is not provided, and will merge the loaded configuration with the provided options.

When using inject-manifest, the resolverOptions.isWrongInjectManifest callback must resolve if the strategy is wrong, the implementation should be:

  • if the service worker with .ts or .mts extension, then, it is build-sw and not inject-manifest strategy: must return true
  • if the service worker outside public dir, then, it is build-sw and not inject-manifest strategy: must return true
  • otherwise must return false

Parameters ​

  • pwaOptions – The PWA options to resolve.

  • resolverOptions – The resolver options containing environment information and callbacks.

Returns: The resolved PWA options.

Released under the MIT License.