{"record":{"id":"e696d81549fad1d8","repo":"angular/angular-cli","slug":"no-production-configuration-found-for-build-targ","errorCode":null,"errorMessage":"No \"production\" configuration found for build target. The \"serviceWorker\" option with a value of \"${ngswConfigPath}\" will need to be set manually.","messagePattern":"No \"production\" configuration found for build target\\. The \"serviceWorker\" option with a value of \"(.+?)\" will need to be set manually\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/schematics/angular/service-worker/index.ts","lineNumber":130,"sourceCode":"    }\n    const buildTarget = project.targets.get('build');\n    if (!buildTarget) {\n      throw targetBuildNotFoundError();\n    }\n\n    const buildOptions = buildTarget.options as Record<string, string | boolean>;\n    const browserEntryPoint = await getMainFilePath(tree, options.project);\n    const ngswConfigPath = join(project.root, 'ngsw-config.json');\n\n    if (\n      buildTarget.builder === Builders.Application ||\n      buildTarget.builder === Builders.BuildApplication\n    ) {\n      const productionConf = buildTarget.configurations?.production;\n      if (productionConf) {\n        productionConf.serviceWorker = ngswConfigPath;\n      } else {\n        logger.warn(\n          'No \"production\" configuration found for build target. ' +\n            `The \"serviceWorker\" option with a value of \"${ngswConfigPath}\" will need to be set manually.`,\n        );\n      }\n    } else {\n      buildOptions.serviceWorker = true;\n      buildOptions.ngswConfigPath = ngswConfigPath;\n    }\n\n    await writeWorkspace(tree, workspace);\n\n    return chain([\n      addDependencies(),\n      mergeWith(\n        apply(url('./files'), [\n          applyTemplates({\n            ...options,\n            relativePathToWorkspaceRoot: relativePathToWorkspaceRoot(project.root),","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/service-worker/index.ts#L112-L148","documentation":"The service-worker schematic adds @angular/service-worker and wires ngsw-config.json into the build target. If the target uses a modern application builder but has no 'production' configuration block, the schematic cannot set serviceWorker automatically and warns that you must add it yourself.","triggerScenarios":"Running the service-worker schematic (ng add @angular/pwa or the service-worker schematic) on a project whose build target builder is BuildApplication/BuildDevServer but buildTarget.configurations.production is undefined.","commonSituations":"Projects created or trimmed without a production configuration in angular.json, or projects migrated to the application builder with custom/simplified configurations.","solutions":["Add a \"production\" configuration to the build target in angular.json","Inside it set \"serviceWorker\": \"ngsw-config.json\" (path to your ngsw-config.json)","Verify the build target's builder is the application builder and re-run ng add / the build to confirm ngsw is wired"],"exampleFix":"// before (angular.json build target)\n\"configurations\": { \"development\": { ... } }\n// after\n\"configurations\": {\n  \"production\": { \"serviceWorker\": \"ngsw-config.json\", \"outputHashing\": \"all\" }\n}","handlingStrategy":"validation","validationCode":"// before running the service-worker schematic, ensure a production configuration exists\nconst build = angularJson.projects[proj].architect?.build;\nconst usesApplicationBuilder = ['@angular-devkit/build-angular:application','@angular/build:application'].includes(build?.builder);\nif (usesApplicationBuilder && !build.configurations?.production) {\n  console.warn('Add a production configuration before adding a service worker');\n}","typeGuard":"function hasProductionConf(buildTarget) {\n  return typeof buildTarget?.builder === 'string' &&\n    buildTarget.configurations != null &&\n    typeof buildTarget.configurations.production === 'object' &&\n    buildTarget.configurations.production !== null;\n}","tryCatchPattern":null,"preventionTips":["Never strip the production configuration from angular.json build targets","After builder migrations, re-add required production options (outputHashing, serviceWorker, budgets)","Run builds with --configuration production regularly to surface missing production config early"],"tags":["angular","schematics","service-worker","pwa","configuration"],"backgroundTag":"missing-production-configuration","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}