From f4da756560358273098df2a5cae7848201206c77 Mon Sep 17 00:00:00 2001 From: Wagner Maciel Date: Tue, 26 Apr 2022 11:09:29 -0700 Subject: [PATCH] fix(@angular/cli): change wrapping of schematic code (cherry picked from commit 4b07aa345d18ae6cb92284cdf13941b61ae69008) --- packages/angular/cli/models/schematic-engine-host.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/angular/cli/models/schematic-engine-host.ts b/packages/angular/cli/models/schematic-engine-host.ts index 57d678321d76..51047475a15d 100644 --- a/packages/angular/cli/models/schematic-engine-host.ts +++ b/packages/angular/cli/models/schematic-engine-host.ts @@ -178,7 +178,9 @@ function wrap( const schematicCode = readFileSync(schematicFile, 'utf8'); // `module` is required due to @angular/localize ng-add being in UMD format const headerCode = '(function() {\nvar exports = {};\nvar module = { exports };\n'; - const footerCode = exportName ? `\nreturn exports['${exportName}'];});` : '\nreturn exports;});'; + const footerCode = exportName + ? `\nreturn module.exports['${exportName}'];});` + : '\nreturn module.exports;});'; const script = new Script(headerCode + schematicCode + footerCode, { filename: schematicFile,