File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
283
283
generateRound ++ ;
284
284
} ,
285
285
286
- _onwrite ( { file } : OutputOptions ) : void
286
+ _onwrite ( { file, dir } : OutputOptions ) : void
287
287
{
288
288
if ( parsedConfig . options . declaration )
289
289
{
@@ -300,6 +300,7 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
300
300
} ) ;
301
301
302
302
const bundleFile = file ;
303
+ const outputDir = dir ;
303
304
304
305
const writeDeclaration = ( key : string , extension : string , entry ?: tsTypes . OutputFile ) =>
305
306
{
@@ -313,12 +314,12 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
313
314
let writeToPath : string ;
314
315
// If for some reason no 'dest' property exists or if 'useTsconfigDeclarationDir' is given in the plugin options,
315
316
// use the path provided by Typescript's LanguageService.
316
- if ( ! bundleFile || pluginOptions . useTsconfigDeclarationDir )
317
+ if ( ( ! bundleFile && ! outputDir ) || pluginOptions . useTsconfigDeclarationDir )
317
318
writeToPath = fileName ;
318
319
else
319
320
{
320
321
// Otherwise, take the directory name from the path and make sure it is absolute.
321
- const destDirname = dirname ( bundleFile ) ;
322
+ const destDirname = bundleFile ? dirname ( bundleFile ) : < string > outputDir ;
322
323
const destDirectory = isAbsolute ( destDirname ) ? destDirname : join ( process . cwd ( ) , destDirname ) ;
323
324
writeToPath = join ( destDirectory , relative ( process . cwd ( ) , fileName ) ) ;
324
325
}
You can’t perform that action at this time.
0 commit comments