mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(compiler-cli): throw an error when compiling with View Engine. (#43862)
The View Engine compiler now throws when constructed and will be removed shortly. Direct users should switch to `NgtscProgram` to build with [Ivy](https://angular.io/guide/ivy). The View Engine compiler is being removed, so this makes it throw an error to ensure no one accidentally depends on code being removed. PR Close #43862
This commit is contained in:
committed by
Andrew Kushnir
parent
57bf6b7cbd
commit
aafde79a71
@@ -38,6 +38,12 @@ import {createMessageDiagnostic, DTS, GENERATED_FILES, isInRootDir, ngToTsDiagno
|
||||
*/
|
||||
const MAX_FILE_COUNT_FOR_SINGLE_FILE_EMIT = 20;
|
||||
|
||||
/** Error message to show when attempting to build View Engine. */
|
||||
const VE_DISABLED_MESSAGE = `
|
||||
This compilation is using the View Engine compiler which is no longer supported by the Angular team
|
||||
and is being removed. Please upgrade to the Ivy compiler by switching to \`NgtscProgram\`. See
|
||||
https://angular.io/guide/ivy for more information.
|
||||
`.trim().split('\n').join(' ');
|
||||
|
||||
/**
|
||||
* Fields to lower within metadata in render2 mode.
|
||||
@@ -110,6 +116,10 @@ class AngularCompilerProgram implements Program {
|
||||
constructor(
|
||||
rootNames: ReadonlyArray<string>, private options: CompilerOptions,
|
||||
private host: CompilerHost, oldProgram?: Program) {
|
||||
if (true as boolean) {
|
||||
throw new Error(VE_DISABLED_MESSAGE);
|
||||
}
|
||||
|
||||
this.rootNames = [...rootNames];
|
||||
|
||||
if (!options.disableTypeScriptVersionCheck) {
|
||||
|
||||
Reference in New Issue
Block a user