File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -103,11 +103,10 @@ export const plugin: UnpluginInstance<Options | undefined, false> =
103103 rollup : {
104104 options ( rollupOptions ) {
105105 let outBase = ''
106- const input = rollupOptions . input
106+ let input = rollupOptions . input
107+ input = typeof input === 'string' ? [ input ] : input
107108 if ( Array . isArray ( input ) ) {
108109 outBase = lowestCommonAncestor ( ...input )
109- } else if ( typeof input === 'string' ) {
110- outBase = path . dirname ( input )
111110 }
112111
113112 if ( ! contexts . length ) contexts . push ( { } as any )
@@ -124,7 +123,8 @@ export const plugin: UnpluginInstance<Options | undefined, false> =
124123export default plugin
125124
126125function lowestCommonAncestor ( ...filepaths : string [ ] ) {
127- if ( filepaths . length <= 1 ) return ''
126+ if ( filepaths . length === 0 ) return ''
127+ if ( filepaths . length === 1 ) return path . dirname ( filepaths [ 0 ] )
128128 const [ first , ...rest ] = filepaths
129129 let ancestor = first . split ( path . sep )
130130 for ( const filepath of rest ) {
You can’t perform that action at this time.
0 commit comments