File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
packages/angular_devkit/build_angular/src Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,6 @@ export function buildWebpackBrowser(
243243 const tsConfig = readTsconfig ( options . tsConfig , context . workspaceRoot ) ;
244244 const target = tsConfig . options . target || ScriptTarget . ES5 ;
245245 const buildBrowserFeatures = new BuildBrowserFeatures ( projectRoot , target ) ;
246-
247246 const isDifferentialLoadingNeeded = buildBrowserFeatures . isDifferentialLoadingNeeded ( ) ;
248247
249248 if ( target > ScriptTarget . ES2015 && isDifferentialLoadingNeeded ) {
@@ -471,6 +470,7 @@ export function buildWebpackBrowser(
471470 const runtimeOptions = {
472471 ...processRuntimeAction ,
473472 runtimeData : processResults ,
473+ supportedBrowsers : buildBrowserFeatures . supportedBrowsers ,
474474 } ;
475475 processResults . push (
476476 await import ( '../utils/process-bundle' ) . then ( m => m . process ( runtimeOptions ) ) ,
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ import { feature, features } from 'caniuse-lite';
1111import * as ts from 'typescript' ;
1212
1313export class BuildBrowserFeatures {
14- private readonly _supportedBrowsers : string [ ] ;
1514 private readonly _es6TargetOrLater : boolean ;
15+ readonly supportedBrowsers : string [ ] ;
1616
1717 constructor (
1818 private projectRoot : string ,
1919 private scriptTarget : ts . ScriptTarget ,
2020 ) {
21- this . _supportedBrowsers = browserslist ( undefined , { path : this . projectRoot } ) ;
21+ this . supportedBrowsers = browserslist ( undefined , { path : this . projectRoot } ) ;
2222 this . _es6TargetOrLater = this . scriptTarget > ts . ScriptTarget . ES5 ;
2323 }
2424
@@ -53,7 +53,7 @@ export class BuildBrowserFeatures {
5353 'ios_saf 10.3' ,
5454 ] ;
5555
56- return this . _supportedBrowsers . some ( browser => safariBrowsers . includes ( browser ) ) ;
56+ return this . supportedBrowsers . some ( browser => safariBrowsers . includes ( browser ) ) ;
5757 }
5858
5959 /**
@@ -71,7 +71,7 @@ export class BuildBrowserFeatures {
7171
7272 const data = feature ( features [ featureId ] ) ;
7373
74- return ! this . _supportedBrowsers
74+ return ! this . supportedBrowsers
7575 . some ( browser => {
7676 const [ agentId , version ] = browser . split ( ' ' ) ;
7777
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export interface ProcessBundleOptions {
4646 integrityAlgorithm ?: 'sha256' | 'sha384' | 'sha512' ;
4747 runtimeData ?: ProcessBundleResult [ ] ;
4848 replacements ?: [ string , string ] [ ] ;
49+ supportedBrowsers ?: string [ ] | Record < string , string > ;
4950}
5051
5152export interface ProcessBundleResult {
@@ -129,6 +130,8 @@ export async function process(options: ProcessBundleOptions): Promise<ProcessBun
129130 presets : [ [
130131 require . resolve ( '@babel/preset-env' ) ,
131132 {
133+ // browserslist-compatible query or object of minimum environment versions to support
134+ targets : options . supportedBrowsers ,
132135 // modules aren't needed since the bundles use webpack's custom module loading
133136 modules : false ,
134137 // 'transform-typeof-symbol' generates slower code
You can’t perform that action at this time.
0 commit comments