@@ -7,7 +7,6 @@ import { logSuccess, addDependencies, overwriteJsonFile,
77import { addResetCss } from './add-normalize' ;
88import { getWorkspace } from '@schematics/angular/utility/config' ;
99import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models' ;
10- import * as path from 'path' ;
1110
1211
1312/**
@@ -19,9 +18,7 @@ function propertyExistsInWorkspace(targetProp: string, workspace: WorkspaceSchem
1918}
2019
2120function enablePolyfills ( tree : Tree , context : SchematicContext ) : string {
22- const workspace = getWorkspace ( tree ) ;
23- const targetFile = getDefaultProjectBuildOptions ( tree ) [ 'polyfills' ] ||
24- path . join ( workspace . projects [ workspace . defaultProject ] . sourceRoot , 'polyfills.ts' ) ;
21+ const targetFile = getDefaultProjectBuildOptions ( tree ) [ 'polyfills' ] ;
2522 if ( ! tree . exists ( targetFile ) ) {
2623 context . logger . warn ( `${ targetFile } not found. You may need to update polyfills.ts manually.` ) ;
2724 return ;
@@ -54,7 +51,7 @@ function readInput(options: Options): Rule {
5451 if ( options . polyfills ) {
5552 const workspace = getWorkspace ( tree ) ;
5653 const targetProperty = 'es5BrowserSupport' ;
57- const polyfillsFile = path . join ( workspace . projects [ workspace . defaultProject ] . sourceRoot , 'polyfills.ts' ) ;
54+ const polyfillsFile = getDefaultProjectBuildOptions ( tree ) [ 'polyfills' ] ;
5855 const propertyExists = propertyExistsInWorkspace ( targetProperty , workspace ) ;
5956 let polyfillsData = tree . read ( polyfillsFile ) . toString ( ) ;
6057 if ( propertyExists ) {
0 commit comments