|
7 | 7 | */
|
8 | 8 | import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
|
9 | 9 | import { EmittedFiles, WebpackLoggingCallback, runWebpack } from '@angular-devkit/build-webpack';
|
10 |
| -import { getSystemPath, json, normalize, resolve, tags } from '@angular-devkit/core'; |
| 10 | +import { getSystemPath, json, logging, normalize, resolve, tags } from '@angular-devkit/core'; |
11 | 11 | import * as fs from 'fs';
|
12 | 12 | import * as path from 'path';
|
13 | 13 | import { Observable, from } from 'rxjs';
|
@@ -229,18 +229,7 @@ export function buildWebpackBrowser(
|
229 | 229 | `);
|
230 | 230 | }
|
231 | 231 |
|
232 |
| - const hasIE9 = buildBrowserFeatures.supportedBrowsers.includes('ie 9'); |
233 |
| - const hasIE10 = buildBrowserFeatures.supportedBrowsers.includes('ie 10'); |
234 |
| - if (hasIE9 || hasIE10) { |
235 |
| - const browsers = |
236 |
| - (hasIE9 ? 'IE 9' + (hasIE10 ? ' & ' : '') : '') + (hasIE10 ? 'IE 10' : ''); |
237 |
| - context.logger.warn( |
238 |
| - `Warning: Support was requested for ${browsers} in the project's browserslist configuration. ` + |
239 |
| - (hasIE9 && hasIE10 ? 'These browsers are' : 'This browser is') + |
240 |
| - ' no longer officially supported with Angular v11 and higher.' + |
241 |
| - '\nFor additional information: https://v10.angular.io/guide/deprecations#ie-9-10-and-mobile', |
242 |
| - ); |
243 |
| - } |
| 232 | + checkInternetExplorerSupport(buildBrowserFeatures.supportedBrowsers, context.logger); |
244 | 233 |
|
245 | 234 | return {
|
246 | 235 | ...(await initialize(options, context, isDifferentialLoadingNeeded, transforms.webpackConfiguration)),
|
@@ -811,4 +800,28 @@ function mapEmittedFilesToFileInfo(files: EmittedFiles[] = []): FileInfo[] {
|
811 | 800 | return filteredFiles;
|
812 | 801 | }
|
813 | 802 |
|
| 803 | +function checkInternetExplorerSupport(supportedBrowsers: string[], logger: logging.LoggerApi): void { |
| 804 | + const hasIE9 = supportedBrowsers.includes('ie 9'); |
| 805 | + const hasIE10 = supportedBrowsers.includes('ie 10'); |
| 806 | + const hasIE11 = supportedBrowsers.includes('ie 11'); |
| 807 | + |
| 808 | + if (hasIE9 || hasIE10) { |
| 809 | + const browsers = (hasIE9 ? 'IE 9' + (hasIE10 ? ' & ' : '') : '') + (hasIE10 ? 'IE 10' : ''); |
| 810 | + logger.warn( |
| 811 | + `Warning: Support was requested for ${browsers} in the project's browserslist configuration. ` + |
| 812 | + (hasIE9 && hasIE10 ? 'These browsers are' : 'This browser is') + |
| 813 | + ' no longer officially supported with Angular v11 and higher.' + |
| 814 | + '\nFor more information, see https://v10.angular.io/guide/deprecations#ie-9-10-and-mobile', |
| 815 | + ); |
| 816 | + } |
| 817 | + |
| 818 | + if (hasIE11) { |
| 819 | + logger.warn( |
| 820 | + `Warning: Support was requested for IE 11 in the project's browserslist configuration. ` + |
| 821 | + 'IE 11 support is deprecated since Angular v12.' + |
| 822 | + '\nFor more information, see https://angular.io/guide/browser-support', |
| 823 | + ); |
| 824 | + } |
| 825 | +} |
| 826 | + |
814 | 827 | export default createBuilder<json.JsonObject & BrowserBuilderSchema>(buildWebpackBrowser);
|
0 commit comments