File tree 3 files changed +8
-5
lines changed
packages/angular_devkit/build_angular/src 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,6 @@ export function buildWebpackBrowser(
243
243
const tsConfig = readTsconfig ( options . tsConfig , context . workspaceRoot ) ;
244
244
const target = tsConfig . options . target || ScriptTarget . ES5 ;
245
245
const buildBrowserFeatures = new BuildBrowserFeatures ( projectRoot , target ) ;
246
-
247
246
const isDifferentialLoadingNeeded = buildBrowserFeatures . isDifferentialLoadingNeeded ( ) ;
248
247
249
248
if ( target > ScriptTarget . ES2015 && isDifferentialLoadingNeeded ) {
@@ -471,6 +470,7 @@ export function buildWebpackBrowser(
471
470
const runtimeOptions = {
472
471
...processRuntimeAction ,
473
472
runtimeData : processResults ,
473
+ supportedBrowsers : buildBrowserFeatures . supportedBrowsers ,
474
474
} ;
475
475
processResults . push (
476
476
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';
11
11
import * as ts from 'typescript' ;
12
12
13
13
export class BuildBrowserFeatures {
14
- private readonly _supportedBrowsers : string [ ] ;
15
14
private readonly _es6TargetOrLater : boolean ;
15
+ readonly supportedBrowsers : string [ ] ;
16
16
17
17
constructor (
18
18
private projectRoot : string ,
19
19
private scriptTarget : ts . ScriptTarget ,
20
20
) {
21
- this . _supportedBrowsers = browserslist ( undefined , { path : this . projectRoot } ) ;
21
+ this . supportedBrowsers = browserslist ( undefined , { path : this . projectRoot } ) ;
22
22
this . _es6TargetOrLater = this . scriptTarget > ts . ScriptTarget . ES5 ;
23
23
}
24
24
@@ -53,7 +53,7 @@ export class BuildBrowserFeatures {
53
53
'ios_saf 10.3' ,
54
54
] ;
55
55
56
- return this . _supportedBrowsers . some ( browser => safariBrowsers . includes ( browser ) ) ;
56
+ return this . supportedBrowsers . some ( browser => safariBrowsers . includes ( browser ) ) ;
57
57
}
58
58
59
59
/**
@@ -71,7 +71,7 @@ export class BuildBrowserFeatures {
71
71
72
72
const data = feature ( features [ featureId ] ) ;
73
73
74
- return ! this . _supportedBrowsers
74
+ return ! this . supportedBrowsers
75
75
. some ( browser => {
76
76
const [ agentId , version ] = browser . split ( ' ' ) ;
77
77
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export interface ProcessBundleOptions {
46
46
integrityAlgorithm ?: 'sha256' | 'sha384' | 'sha512' ;
47
47
runtimeData ?: ProcessBundleResult [ ] ;
48
48
replacements ?: [ string , string ] [ ] ;
49
+ supportedBrowsers ?: string [ ] | Record < string , string > ;
49
50
}
50
51
51
52
export interface ProcessBundleResult {
@@ -129,6 +130,8 @@ export async function process(options: ProcessBundleOptions): Promise<ProcessBun
129
130
presets : [ [
130
131
require . resolve ( '@babel/preset-env' ) ,
131
132
{
133
+ // browserslist-compatible query or object of minimum environment versions to support
134
+ targets : options . supportedBrowsers ,
132
135
// modules aren't needed since the bundles use webpack's custom module loading
133
136
modules : false ,
134
137
// 'transform-typeof-symbol' generates slower code
You can’t perform that action at this time.
0 commit comments