@@ -39,10 +39,22 @@ export function transformCompilerOptions(
3939 const warnings : PartialMessage [ ] = [ ] ;
4040 const isLibrary = buildType === 'library' ;
4141
42+ if ( isLibrary ) {
43+ compilerOptions . target = typeScript . ScriptTarget . ES2022 ;
44+ compilerOptions . module = typeScript . ModuleKind . ES2022 ;
45+ compilerOptions . importHelpers = true ;
46+ compilerOptions . declaration = true ;
47+ compilerOptions . declarationMap = ! ! (
48+ overrides ?. declarationMap ?? compilerOptions . declarationMap
49+ ) ;
50+ compilerOptions . declarationDir = undefined ;
51+ compilerOptions . noEmit = false ;
52+ compilerOptions . emitDeclarationOnly = false ;
53+ }
54+
4255 if (
43- ! isLibrary &&
44- ( compilerOptions . target === undefined ||
45- compilerOptions . target < typeScript . ScriptTarget . ES2022 )
56+ compilerOptions . target === undefined ||
57+ compilerOptions . target < typeScript . ScriptTarget . ES2022
4658 ) {
4759 // If 'useDefineForClassFields' is already defined in the users project leave the value as is.
4860 // Otherwise fallback to false due to https://github.com/microsoft/TypeScript/issues/45995
@@ -87,21 +99,6 @@ export function transformCompilerOptions(
8799 compilerOptions . incremental = false ;
88100 }
89101
90- if ( isLibrary ) {
91- compilerOptions . target = typeScript . ScriptTarget . ES2022 ;
92- compilerOptions . module = typeScript . ModuleKind . ES2022 ;
93- compilerOptions . moduleResolution = typeScript . ModuleResolutionKind . Bundler ;
94- compilerOptions . importHelpers = true ;
95- compilerOptions . declaration = true ;
96- compilerOptions . declarationMap = ! ! (
97- overrides ?. declarationMap ?? compilerOptions . declarationMap
98- ) ;
99- compilerOptions . declarationDir = undefined ;
100- compilerOptions . noEmit = false ;
101- compilerOptions . emitDeclarationOnly = false ;
102- compilerOptions . emitDecoratorMetadata = false ;
103- }
104-
105102 if (
106103 compilerOptions . module === undefined ||
107104 compilerOptions . module < typeScript . ModuleKind . ES2015
0 commit comments