Skip to content

Commit 71b433c

Browse files
Use the development configuration instead of our own created serve configuration, this development configuration also uses a lot of the default properties, so many of them were correct already
1 parent ea54bad commit 71b433c

2 files changed

Lines changed: 18 additions & 23 deletions

File tree

src/application/index.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ describe('Application Schematic', () => {
8989
const configurations = prj.architect.build.configurations;
9090
expect(configurations.production).not.toBeDefined();
9191
expect(Object.getOwnPropertyNames(configurations).length).toEqual(1);
92-
expect(configurations.serve).toBeDefined();
93-
expect(configurations.serve.aot).toBeUndefined();
94-
expect(configurations.serve.buildOptimizer).toBeFalse();
95-
expect(configurations.serve.optimization).toBeFalse();
96-
expect(configurations.serve.extractLicenses).toBeFalse();
97-
expect(configurations.serve.statsJson).toBeFalse();
98-
expect(configurations.serve.sourceMap).toBeTrue();
99-
expect(configurations.serve.vendorChunk).toBeTrue();
100-
expect(configurations.serve.namedChunks).toBeTrue();
101-
expect(configurations.serve.fileReplacements).toBeUndefined();
92+
expect(configurations.development).toBeDefined();
93+
expect(configurations.development.aot).toBeUndefined();
94+
expect(configurations.development.buildOptimizer).toBeFalse();
95+
expect(configurations.development.optimization).toBeFalse();
96+
expect(configurations.development.extractLicenses).toBeFalse();
97+
expect(configurations.development.statsJson).toBeFalse();
98+
expect(configurations.development.sourceMap).toBeUndefined();
99+
expect(configurations.development.vendorChunk).toBeUndefined();
100+
expect(configurations.development.namedChunks).toBeUndefined();
101+
expect(configurations.development.fileReplacements).toBeUndefined();
102102
});
103103

104104
it('should configure test options', async () => {

src/application/index.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,14 @@ function configureBuildConfigurations(project: ProjectDefinition) {
181181
if (buildTarget.configurations === undefined) {
182182
throw new SchematicsException("Expected build configurations to be defined");
183183
}
184-
185-
buildTarget.configurations = {
186-
serve: {
187-
buildOptimizer: false,
188-
optimization: false,
189-
extractLicenses: false,
190-
statsJson: false,
191-
sourceMap: true,
192-
vendorChunk: true,
193-
namedChunks: true
194-
}
195-
};
196-
delete buildTarget['defaultConfiguration'];
184+
if (buildTarget.configurations.development === undefined) {
185+
throw new SchematicsException("Expected build configurations development to be defined");
186+
}
187+
buildTarget.configurations.development['statsJson'] = false;
188+
delete buildTarget.configurations.development.vendorChunk; // Already defaulted correctly in build options
189+
delete buildTarget.configurations.development.sourceMap; // Already defaulted correctly in build options
190+
delete buildTarget.configurations.development.namedChunks; // Already defaulted correctly in build options
191+
delete buildTarget.defaultConfiguration; // There is no production configuration (the default is no configuration, only overrideable by the development configuration)
197192
}
198193

199194
function configureTsLint(project: ProjectDefinition) {

0 commit comments

Comments
 (0)