Skip to content

Commit

Permalink
Fix angular project without 'architect.build' option to be worked
Browse files Browse the repository at this point in the history
  • Loading branch information
seokju-na committed May 7, 2019
1 parent ed25d09 commit 2c9b2ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/angular/src/server/angular-cli_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function getAngularCliWebpackConfigOptions(dirToSearch) {
project = projects[defaultProject];
}

if (!project.architect.build) {
return null;
}

const { options: projectOptions } = project.architect.build;

const normalizedAssets = normalizeAssetPatterns(
Expand Down
10 changes: 10 additions & 0 deletions app/angular/src/server/angular-cli_config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,15 @@ describe('angualr-cli_config', () => {
},
});
});

it('should return null if `architect.build` option are not exists.', () => {
const angularJsonWithNoBuildOptions = { ...angularJson };
angularJsonWithNoBuildOptions.projects['angular-cli'].architect.build = undefined;

setupFiles({ 'angular.json': JSON.stringify(angularJsonWithNoBuildOptions) });

const config = getAngularCliWebpackConfigOptions('/');
expect(config).toBeNull();
});
});
});

0 comments on commit 2c9b2ea

Please sign in to comment.