diff --git a/packages/workbox-build/src/lib/populate-sw-template.ts b/packages/workbox-build/src/lib/populate-sw-template.ts index 1a9009d0b..0f00e9858 100644 --- a/packages/workbox-build/src/lib/populate-sw-template.ts +++ b/packages/workbox-build/src/lib/populate-sw-template.ts @@ -33,7 +33,7 @@ export function populateSWTemplate({ skipWaiting, }: GeneratePartial & {manifestEntries?: Array}): string { // There needs to be at least something to precache, or else runtime caching. - if (!(manifestEntries.length > 0 || runtimeCaching.length > 0)) { + if (!(manifestEntries?.length > 0 || runtimeCaching.length > 0)) { throw new Error(errors['no-manifest-entries-or-runtime-caching']); } diff --git a/packages/workbox-webpack-plugin/src/inject-manifest.ts b/packages/workbox-webpack-plugin/src/inject-manifest.ts index 9c8fa68b5..754ce63a8 100644 --- a/packages/workbox-webpack-plugin/src/inject-manifest.ts +++ b/packages/workbox-webpack-plugin/src/inject-manifest.ts @@ -280,7 +280,6 @@ class InjectManifest { try { this.config = validateWebpackInjectManifestOptions(this.config); } catch (error) { - // eslint-disable-next-line if (error instanceof Error) { throw new Error( `Please check your ${this.constructor.name} plugin ` + @@ -380,12 +379,9 @@ class InjectManifest { if ( this.config.compileSrc && // See https://github.com/GoogleChrome/workbox/issues/2729 - // (TODO: Switch to ?. once our linter supports it.) !( - compilation.options && - compilation.options.devtool === 'eval-cheap-source-map' && - compilation.options.optimization && - compilation.options.optimization.minimize + compilation.options?.devtool === 'eval-cheap-source-map' && + compilation.options.optimization?.minimize ) ) { // See https://github.com/GoogleChrome/workbox/issues/2263