Skip to content

Commit

Permalink
Merge pull request #1051 from ckeditor/always-use-typescript-plugin-i…
Browse files Browse the repository at this point in the history
…n-build-tools

Fix (build-tools): Always enable the TypeScript plugin, even when `declarations` is set to `false`. Fixes ckeditor/ckeditor5#17653.
  • Loading branch information
filipsobol authored Dec 18, 2024
2 parents e9f9d41 + abcc8c2 commit 86f5db1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/ckeditor5-dev-build-tools/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ export async function getRollupConfig( options: BuildOptions ) {
/**
* Does type checking and generates `.d.ts` files.
*/
getOptionalPlugin(
declarations,
getTypeScriptPlugin( { tsconfig, output, sourceMap, declarations } )
),
getTypeScriptPlugin( { tsconfig, output, sourceMap, declarations } ),

/**
* Replaces parts of the source code with the provided values.
Expand Down Expand Up @@ -309,7 +306,11 @@ function getTypeScriptPlugin( {
declaration: declarations,
declarationDir: declarations ? path.parse( output ).dir : undefined,
compilerOptions: {
emitDeclarationOnly: true
// When `declarations` is set to `true`, we only want to emit declaration files.
emitDeclarationOnly: !!declarations,

// Otherwise, we don't want to emit anything.
noEmit: !declarations
}
} );
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test( '--tsconfig', async () => {

expect( fileExists.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( true );
expect( fileDoesntExist.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( false );
expect( declarationsFalse.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( false );
expect( declarationsFalse.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( true );
} );

test( '--external', async () => {
Expand Down

0 comments on commit 86f5db1

Please sign in to comment.