@@ -18,13 +18,15 @@ import {
18
18
logging ,
19
19
normalize ,
20
20
resolve ,
21
+ tags ,
21
22
virtualFs ,
22
23
} from '@angular-devkit/core' ;
23
24
import { NodeJsSyncHost } from '@angular-devkit/core/node' ;
24
25
import * as fs from 'fs' ;
25
26
import * as path from 'path' ;
26
- import { concat , from , of , zip } from 'rxjs' ;
27
+ import { from , of } from 'rxjs' ;
27
28
import { bufferCount , catchError , concatMap , map , mergeScan , switchMap } from 'rxjs/operators' ;
29
+ import * as ts from 'typescript' ;
28
30
import * as webpack from 'webpack' ;
29
31
import { NgBuildAnalyticsPlugin } from '../../plugins/webpack/analytics' ;
30
32
import { WebpackConfigOptions } from '../angular-cli-files/models/build-options' ;
@@ -38,14 +40,15 @@ import {
38
40
getWorkerConfig ,
39
41
} from '../angular-cli-files/models/webpack-configs' ;
40
42
import { writeIndexHtml } from '../angular-cli-files/utilities/index-file/write-index-html' ;
43
+ import { readTsconfig } from '../angular-cli-files/utilities/read-tsconfig' ;
41
44
import { augmentAppWithServiceWorker } from '../angular-cli-files/utilities/service-worker' ;
42
45
import {
43
46
statsErrorsToString ,
44
47
statsToString ,
45
48
statsWarningsToString ,
46
49
} from '../angular-cli-files/utilities/stats' ;
47
50
import { ExecutionTransformer } from '../transforms' ;
48
- import { deleteOutputDir } from '../utils' ;
51
+ import { deleteOutputDir , isEs5SupportNeeded } from '../utils' ;
49
52
import { generateBrowserWebpackConfigFromContext } from '../utils/webpack-browser-config' ;
50
53
import { Schema as BrowserBuilderSchema } from './schema' ;
51
54
@@ -182,6 +185,19 @@ export function buildWebpackBrowser(
182
185
normalize ( workspace . getProject ( projectName ) . root ) ,
183
186
) ;
184
187
188
+ const tsConfigPath = path . resolve ( workspace . root , options . tsConfig ) ;
189
+ const tsConfig = readTsconfig ( tsConfigPath ) ;
190
+
191
+ if ( isEs5SupportNeeded ( projectRoot ) &&
192
+ tsConfig . options . target !== ts . ScriptTarget . ES5 &&
193
+ tsConfig . options . target !== ts . ScriptTarget . ES2015 ) {
194
+ context . logger . warn ( tags . stripIndent `
195
+ WARNING: Using differential loading with targets ES5 and ES2016 or higher may
196
+ cause problems. Browsers with support for ES2015 will load the ES2016+ scripts
197
+ referenced with script[type="module"] but they may not support ES2016+ syntax.
198
+ ` ) ;
199
+ }
200
+
185
201
return from ( configs ) . pipe (
186
202
// the concurrency parameter (3rd parameter of mergeScan) is deliberately
187
203
// set to 1 to make sure the build steps are executed in sequence.
0 commit comments