File tree 1 file changed +14
-6
lines changed
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -188,11 +188,9 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
188
188
}
189
189
} else {
190
190
logger . warn (
191
- yellow (
192
- `\n${ cyan (
193
- '[vite:dts]'
194
- ) } You are building a library that may not need to generate declaration files.\n`
195
- )
191
+ `\n${ logPrefix } ${ yellow (
192
+ 'You are building a library that may not need to generate declaration files.'
193
+ ) } \n`
196
194
)
197
195
198
196
libName = '_default'
@@ -547,7 +545,17 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
547
545
( pkg . exports ?. [ '.' ] || pkg . exports ?. [ './' ] ) ?. types
548
546
const multiple = entryNames . length > 1
549
547
550
- const typesPath = types ? resolve ( root , types ) : resolve ( outDir , indexName )
548
+ let typesPath = types ? resolve ( root , types ) : resolve ( outDir , indexName )
549
+
550
+ if ( ! multiple && ! dtsRE . test ( typesPath ) ) {
551
+ logger . warn (
552
+ `\n${ logPrefix } ${ yellow (
553
+ "The resolved path of type entry is not ending with '.d.ts'."
554
+ ) } \n`
555
+ )
556
+
557
+ typesPath = `${ typesPath . replace ( tjsRE , '' ) } .d.${ extPrefix ( typesPath ) } ts`
558
+ }
551
559
552
560
for ( const name of entryNames ) {
553
561
const path = multiple ? resolve ( outDir , `${ name . replace ( tsRE , '' ) } .d.ts` ) : typesPath
You can’t perform that action at this time.
0 commit comments