MCPcopy Index your code
hub / github.com/angular/angular / getCompilerFacade

Function getCompilerFacade

packages/core/src/compiler/compiler_facade.ts:23–49  ·  view source on GitHub ↗
(request: JitCompilerUsageRequest)

Source from the content-addressed store, hash-verified

21}
22
23export function getCompilerFacade(request: JitCompilerUsageRequest): CompilerFacade {
24 const globalNg: ExportedCompilerFacade = global['ng'];
25 if (globalNg && globalNg.ɵcompilerFacade) {
26 return globalNg.ɵcompilerFacade;
27 }
28
29 if (typeof ngDevMode === 'undefined' || ngDevMode) {
30 // Log the type as an error so that a developer can easily navigate to the type from the
31 // console.
32 console.error(`JIT compilation failed for ${request.kind}`, request.type);
33
34 let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.\n\n`;
35 if (request.usage === JitCompilerUsage.PartialDeclaration) {
36 message += `The ${request.kind} is part of a library that has been partially compiled.\n`;
37 message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.\n`;
38 message += '\n';
39 message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.\n`;
40 } else {
41 message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.\n`;
42 }
43 message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',\n`;
44 message += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`;
45 throw new Error(message);
46 } else {
47 throw new Error('JIT compiler unavailable');
48 }
49}

Callers 15

compileInjectableFunction · 0.90
compileServiceFunction · 0.90
compileNgModuleFactoryFunction · 0.90
compilePipeFunction · 0.90
ɵɵngDeclareDirectiveFunction · 0.90
ɵɵngDeclareComponentFunction · 0.90
ɵɵngDeclareFactoryFunction · 0.90
ɵɵngDeclareInjectableFunction · 0.90
ɵɵngDeclareInjectorFunction · 0.90
ɵɵngDeclareNgModuleFunction · 0.90
ɵɵngDeclarePipeFunction · 0.90

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…