@@ -169,6 +169,8 @@ export function createCompilerPlugin(
169
169
name : 'angular-compiler' ,
170
170
// eslint-disable-next-line max-lines-per-function
171
171
async setup ( build : PluginBuild ) : Promise < void > {
172
+ let setupWarnings : PartialMessage [ ] | undefined ;
173
+
172
174
// This uses a wrapped dynamic import to load `@angular/compiler-cli` which is ESM.
173
175
// Once TypeScript provides support for retaining dynamic imports this workaround can be dropped.
174
176
const compilerCli = await loadEsmModule < typeof import ( '@angular/compiler-cli' ) > (
@@ -223,7 +225,19 @@ export function createCompilerPlugin(
223
225
// which breaks the deprecated `@Effects` NGRX decorator and potentially other existing code as well.
224
226
compilerOptions . target = ts . ScriptTarget . ES2022 ;
225
227
compilerOptions . useDefineForClassFields ??= false ;
226
- // TODO: show warning about this override when we have access to the logger.
228
+
229
+ ( setupWarnings ??= [ ] ) . push ( {
230
+ text :
231
+ 'TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and ' +
232
+ '"false" respectively by the Angular CLI.' ,
233
+ location : { file : pluginOptions . tsconfig } ,
234
+ notes : [
235
+ {
236
+ text : `To control ECMA version and features use the Browerslist configuration. ' +
237
+ 'For more information, see https://github.com/browserslist/browserslist#queries'` ,
238
+ } ,
239
+ ] ,
240
+ } ) ;
227
241
}
228
242
229
243
// The file emitter created during `onStart` that will be used during the build in `onLoad` callbacks for TS files
@@ -237,7 +251,12 @@ export function createCompilerPlugin(
237
251
const babelDataCache = new Map < string , string > ( ) ;
238
252
239
253
build . onStart ( async ( ) => {
240
- const result : OnStartResult = { } ;
254
+ const result : OnStartResult = {
255
+ warnings : setupWarnings ,
256
+ } ;
257
+
258
+ // Reset the setup warnings so that they are only shown during the first build.
259
+ setupWarnings = undefined ;
241
260
242
261
// Reset debug performance tracking
243
262
resetCumulativeDurations ( ) ;
0 commit comments