From 4595a61aebd9a7b27cf82a585959958b85222af4 Mon Sep 17 00:00:00 2001 From: Chuck Jazdzewski Date: Wed, 9 Nov 2016 15:17:24 -0800 Subject: [PATCH] refactor(compiler-cli): refactor imports in codegen to enable rollup (#12781) --- modules/@angular/compiler-cli/src/codegen.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/@angular/compiler-cli/src/codegen.ts b/modules/@angular/compiler-cli/src/codegen.ts index d04a3a3c98..0b271005ed 100644 --- a/modules/@angular/compiler-cli/src/codegen.ts +++ b/modules/@angular/compiler-cli/src/codegen.ts @@ -13,6 +13,7 @@ import * as compiler from '@angular/compiler'; import {ViewEncapsulation} from '@angular/core'; import {AngularCompilerOptions, NgcCliOptions} from '@angular/tsc-wrapped'; +import {readFileSync} from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; @@ -22,8 +23,6 @@ import {ReflectorHost, ReflectorHostContext} from './reflector_host'; import {StaticAndDynamicReflectionCapabilities} from './static_reflection_capabilities'; import {StaticReflector, StaticReflectorHost, StaticSymbol} from './static_reflector'; -const nodeFs = require('fs'); - const GENERATED_FILES = /\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/; const GENERATED_OR_DTS_FILES = /\.d\.ts$|\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/; @@ -100,7 +99,7 @@ export class CodeGenerator { throw new Error( `The translation file (${transFile}) locale must be provided. Use the --locale option.`); } - transContent = nodeFs.readFileSync(transFile, 'utf8'); + transContent = readFileSync(transFile, 'utf8'); } const urlResolver: compiler.UrlResolver = compiler.createOfflineCompileUrlResolver();