Skip to content

Commit 805282a

Browse files
committed
feat(@angular-devkit/build-angular): remove differential loading support
BREAKING CHANGE: Differential loading support has been removed. With Angular no longer supporting IE11, there are now no browsers officially supported by Angular that require ES5 code. As a result, differential loading's functionality for creating and conditionally loading ES5 and ES2015+ variants of an application is no longer required.
1 parent e82eef9 commit 805282a

34 files changed

+131
-2346
lines changed

packages/angular_devkit/build_angular/src/browser/index.ts

+28-379
Large diffs are not rendered by default.

packages/angular_devkit/build_angular/src/browser/specs/browser-support_spec.ts

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ describe('Browser Builder browser support', () => {
1717
beforeEach(async () => {
1818
await host.initialize().toPromise();
1919
architect = (await createArchitect(host.root())).architect;
20-
21-
// target ES5 to disable differential loading which is not needed for the tests
22-
host.replaceInFile('tsconfig.json', '"target": "es2017"', '"target": "es5"');
2320
});
2421
afterEach(async () => host.restore().toPromise());
2522

packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts

-196
This file was deleted.

packages/angular_devkit/build_angular/src/browser/specs/scripts-array_spec.ts

-34
Original file line numberDiff line numberDiff line change
@@ -75,40 +75,6 @@ describe('Browser Builder scripts array', () => {
7575
}
7676
});
7777

78-
it('works in watch mode with differential loading', async () => {
79-
const matches: Record<string, string> = {
80-
'scripts.js': 'input-script',
81-
'lazy-script.js': 'lazy-script',
82-
'renamed-script.js': 'pre-rename-script',
83-
'renamed-lazy-script.js': 'pre-rename-lazy-script',
84-
'main-es2017.js': 'input-script',
85-
'index.html':
86-
'<script src="runtime-es2017.js" type="module"></script>' +
87-
'<script src="polyfills-es2017.js" type="module"></script>' +
88-
'<script src="scripts.js" defer></script>' +
89-
'<script src="renamed-script.js" defer></script>' +
90-
'<script src="vendor-es2017.js" type="module"></script>' +
91-
'<script src="main-es2017.js" type="module"></script>',
92-
};
93-
94-
host.writeMultipleFiles(scripts);
95-
host.appendToFile('src/main.ts', "\nimport './input-script.js';");
96-
97-
// Enable differential loading
98-
host.appendToFile('.browserslistrc', '\nIE 11');
99-
100-
// Remove styles so we don't have to account for them in the index.html order check.
101-
const { files } = await browserBuild(architect, host, target, {
102-
styles: [],
103-
scripts: getScriptsOption(),
104-
watch: true,
105-
} as {});
106-
107-
for (const [fileName, content] of Object.entries(matches)) {
108-
expect(await files[fileName]).toMatch(content);
109-
}
110-
});
111-
11278
it('uglifies, uses sourcemaps, and adds hashes', async () => {
11379
host.writeMultipleFiles(scripts);
11480

packages/angular_devkit/build_angular/src/browser/specs/styles_spec.ts

-12
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ describe('Browser Builder styles', () => {
140140
'.browserslistrc': 'IE 10',
141141
});
142142

143-
// Set target to ES5 to avoid differential loading and unnecessary testing time
144-
host.replaceInFile('tsconfig.json', '"target": "es2017"', '"target": "es5"');
145-
146143
const { files } = await browserBuild(architect, host, target, { aot: false });
147144

148145
expect(await files['main.js']).toContain('-ms-flex: 1;');
@@ -165,9 +162,6 @@ describe('Browser Builder styles', () => {
165162
'.browserslistrc': 'IE 10',
166163
});
167164

168-
// Set target to ES5 to avoid differential loading and unnecessary testing time
169-
host.replaceInFile('tsconfig.json', '"target": "es2017"', '"target": "es5"');
170-
171165
const { files } = await browserBuild(architect, host, target, { aot: true });
172166

173167
expect(await files['main.js']).toContain('-ms-flex: 1;');
@@ -354,9 +348,6 @@ describe('Browser Builder styles', () => {
354348
'.browserslistrc': 'IE 10',
355349
});
356350

357-
// Set to target to ES5 to avoid differential loading and unnecessary testing time
358-
host.replaceInFile('tsconfig.json', '"target": "es2017"', '"target": "es5"');
359-
360351
const overrides = { extractCss: true, optimization: false };
361352
const { files } = await browserBuild(architect, host, target, overrides);
362353
expect(await files['styles.css']).toContain(tags.stripIndents`
@@ -394,9 +385,6 @@ describe('Browser Builder styles', () => {
394385
'.browserslistrc': 'IE 10',
395386
});
396387

397-
// Set target to ES5 to avoid differential loading and unnecessary testing time
398-
host.replaceInFile('tsconfig.json', '"target": "es2017"', '"target": "es5"');
399-
400388
const overrides = { extractCss: true, optimization: true, styles: ['src/styles.scss'] };
401389
const { files } = await browserBuild(architect, host, target, overrides);
402390
expect(await files['styles.css']).toContain('-ms-grid-columns:100px;');

packages/angular_devkit/build_angular/src/dev-server/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ export function serveWebpackBrowser(
311311
const buildBrowserFeatures = new BuildBrowserFeatures(projectRoot);
312312

313313
const entrypoints = generateEntryPoints({ scripts, styles });
314-
const moduleEntrypoints = buildBrowserFeatures.isDifferentialLoadingNeeded(target)
315-
? generateEntryPoints({ scripts: [], styles })
316-
: [];
317314

318315
webpackConfig.plugins = [...(webpackConfig.plugins || [])];
319316
webpackConfig.plugins.push(
@@ -322,7 +319,7 @@ export function serveWebpackBrowser(
322319
outputPath: getIndexOutputFile(browserOptions.index),
323320
baseHref,
324321
entrypoints,
325-
moduleEntrypoints,
322+
moduleEntrypoints: [],
326323
noModuleEntrypoints: ['polyfills-es5'],
327324
deployUrl: browserOptions.deployUrl,
328325
sri: browserOptions.subresourceIntegrity,

0 commit comments

Comments
 (0)