File tree Expand file tree Collapse file tree 2 files changed +40
-5
lines changed
packages/angular/build/src
builders/application/tests/behavior Expand file tree Collapse file tree 2 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright Google LLC All Rights Reserved.
4+ *
5+ * Use of this source code is governed by an MIT-style license that can be
6+ * found in the LICENSE file at https://angular.io/license
7+ */
8+
9+ import { buildApplication } from '../../index' ;
10+ import { APPLICATION_BUILDER_INFO , BASE_OPTIONS , describeBuilder } from '../setup' ;
11+
12+ describeBuilder ( buildApplication , APPLICATION_BUILDER_INFO , ( harness ) => {
13+ describe ( 'Behavior: "TypeScript explicit incremental option usage"' , ( ) => {
14+ it ( 'should successfully build with incremental disabled' , async ( ) => {
15+ // Disable tsconfig incremental option in tsconfig
16+ await harness . modifyFile ( 'tsconfig.json' , ( content ) => {
17+ const tsconfig = JSON . parse ( content ) ;
18+ tsconfig . compilerOptions . incremental = false ;
19+
20+ return JSON . stringify ( tsconfig ) ;
21+ } ) ;
22+
23+ harness . useTarget ( 'build' , {
24+ ...BASE_OPTIONS ,
25+ } ) ;
26+
27+ const { result } = await harness . executeOnce ( ) ;
28+
29+ expect ( result ?. success ) . toBe ( true ) ;
30+ } ) ;
31+ } ) ;
32+ } ) ;
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ export function createCompilerPlugin(
284284 location : null ,
285285 notes : [
286286 {
287- text : error instanceof Error ? error . stack ?? error . message : `${ error } ` ,
287+ text : error instanceof Error ? ( error . stack ?? error . message ) : `${ error } ` ,
288288 location : null ,
289289 } ,
290290 ] ,
@@ -315,7 +315,7 @@ export function createCompilerPlugin(
315315 location : null ,
316316 notes : [
317317 {
318- text : error instanceof Error ? error . stack ?? error . message : `${ error } ` ,
318+ text : error instanceof Error ? ( error . stack ?? error . message ) : `${ error } ` ,
319319 location : null ,
320320 } ,
321321 ] ,
@@ -537,9 +537,12 @@ function createCompilerOptionsTransformer(
537537 compilerOptions . compilationMode = 'full' ;
538538 }
539539
540- // Enable incremental compilation by default if caching is enabled
541- if ( pluginOptions . sourceFileCache ?. persistentCachePath ) {
542- compilerOptions . incremental ??= true ;
540+ // Enable incremental compilation by default if caching is enabled and incremental is not explicitly disabled
541+ if (
542+ compilerOptions . incremental !== false &&
543+ pluginOptions . sourceFileCache ?. persistentCachePath
544+ ) {
545+ compilerOptions . incremental = true ;
543546 // Set the build info file location to the configured cache directory
544547 compilerOptions . tsBuildInfoFile = path . join (
545548 pluginOptions . sourceFileCache ?. persistentCachePath ,
You can’t perform that action at this time.
0 commit comments