Skip to content

Commit ad5d672

Browse files
committed
fix(@schematics/angular): remove explicit index option from new applications
With the index option now defaulting to `<project_source_root>/index.html` for the `application` build system, the explicit value present in new applications is no longer required. This removal further reduces the size of the `angular.json` file for new projects.
1 parent fd6275e commit ad5d672

File tree

7 files changed

+6
-3
lines changed

7 files changed

+6
-3
lines changed

packages/schematics/angular/application/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ function addAppToWorkspaceFile(
256256
builder: Builders.BuildApplication,
257257
defaultConfiguration: 'production',
258258
options: {
259-
index: `${sourceRoot}/index.html`,
260259
browser: `${sourceRoot}/main.ts`,
261260
polyfills: options.experimentalZoneless ? [] : ['zone.js'],
262261
tsConfig: `${projectRoot}tsconfig.app.json`,

packages/schematics/angular/application/index_spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe('Application Schematic', () => {
314314
const prj = config.projects.foo;
315315
expect(prj.root).toEqual('');
316316
const buildOpt = prj.architect.build.options;
317-
expect(buildOpt.index).toEqual('src/index.html');
317+
expect(buildOpt.index).toBeUndefined();
318318
expect(buildOpt.browser).toEqual('src/main.ts');
319319
expect(buildOpt.assets).toEqual([{ 'glob': '**/*', 'input': 'public' }]);
320320
expect(buildOpt.polyfills).toEqual(['zone.js']);
@@ -405,7 +405,6 @@ describe('Application Schematic', () => {
405405
const project = config.projects.foo;
406406
expect(project.root).toEqual('foo');
407407
const buildOpt = project.architect.build.options;
408-
expect(buildOpt.index).toEqual('foo/src/index.html');
409408
expect(buildOpt.browser).toEqual('foo/src/main.ts');
410409
expect(buildOpt.polyfills).toEqual(['zone.js']);
411410
expect(buildOpt.tsConfig).toEqual('foo/tsconfig.app.json');

tests/legacy-cli/e2e/initialize/500-create-project.ts

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default async function () {
3535
main: build.options.browser,
3636
browser: undefined,
3737
outputPath: 'dist/test-project/browser',
38+
index: 'src/index.html',
3839
};
3940

4041
build.configurations.development = {

tests/legacy-cli/e2e/tests/build/prerender/discover-routes-ngmodule.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default async function () {
1919
...build.options,
2020
main: build.options.browser,
2121
browser: undefined,
22+
index: 'src/index.html',
2223
};
2324

2425
build.configurations.development = {

tests/legacy-cli/e2e/tests/build/rebuild-dot-dirname.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default async function () {
3434
main: build.options.browser,
3535
browser: undefined,
3636
outputPath: 'dist/subdirectory-test-project',
37+
index: 'src/index.html',
3738
};
3839

3940
build.configurations.development = {

tests/legacy-cli/e2e/tests/build/relative-sourcemap.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default async function () {
1919
main: build.options.browser,
2020
browser: undefined,
2121
outputPath: 'dist/secondary-project',
22+
index: 'src/index.html',
2223
};
2324

2425
build.configurations.development = {

tests/legacy-cli/e2e/tests/build/server-rendering/express-engine-ngmodule.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default async function () {
3232
...build.options,
3333
main: build.options.browser,
3434
browser: undefined,
35+
index: 'src/index.html',
3536
};
3637

3738
build.configurations.development = {

0 commit comments

Comments
 (0)