Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/schematics/angular/service-worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function getTsSourceFile(host: Tree, path: string): ts.SourceFile {
}

const serviceWorkerSchematic: RuleFactory<ServiceWorkerOptions> = createProjectSchematic(
async (options, { project, workspace, tree }) => {
async (options, { project, workspace, tree, logger }) => {
if (project.extensions.projectType !== 'application') {
throw new SchematicsException(`Service worker requires a project type of "application".`);
}
Expand All @@ -126,6 +126,11 @@ const serviceWorkerSchematic: RuleFactory<ServiceWorkerOptions> = createProjectS
const productionConf = buildTarget.configurations?.production;
if (productionConf) {
productionConf.serviceWorker = ngswConfigPath;
} else {
logger.warn(
'No "production" configuration found for build target. ' +
`The "serviceWorker" option with a value of "${ngswConfigPath}" will need to be set manually.`,
);
}
} else {
buildOptions.serviceWorker = true;
Expand Down
Loading