Skip to content

Commit b1afa31

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 6e9a054 commit b1afa31

File tree

8 files changed

+7
-3
lines changed

8 files changed

+7
-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.zoneless ? undefined : ['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
@@ -330,7 +330,7 @@ describe('Application Schematic', () => {
330330
const prj = config.projects.foo;
331331
expect(prj.root).toEqual('');
332332
const buildOpt = prj.architect.build.options;
333-
expect(buildOpt.index).toEqual('src/index.html');
333+
expect(buildOpt.index).toBeUndefined();
334334
expect(buildOpt.browser).toEqual('src/main.ts');
335335
expect(buildOpt.assets).toEqual([{ 'glob': '**/*', 'input': 'public' }]);
336336
expect(buildOpt.polyfills).toEqual(['zone.js']);
@@ -421,7 +421,6 @@ describe('Application Schematic', () => {
421421
const project = config.projects.foo;
422422
expect(project.root).toEqual('foo');
423423
const buildOpt = project.architect.build.options;
424-
expect(buildOpt.index).toEqual('foo/src/index.html');
425424
expect(buildOpt.browser).toEqual('foo/src/main.ts');
426425
expect(buildOpt.polyfills).toEqual(['zone.js']);
427426
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/jit-ngmodule.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default async function () {
2424
browser: undefined,
2525
buildOptimizer: false,
2626
outputPath: 'dist/test-project-two',
27+
index: 'src/index.html',
2728
};
2829

2930
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)