@@ -28,6 +28,7 @@ interface createRollupConfigOptions {
2828 externalDependencies ?: string [ ] ;
2929 input : string ;
3030 nodeTarget ?: string ;
31+ withMultipleInputs : boolean ;
3132 outputDir : string ;
3233 pkgMain : string ;
3334}
@@ -37,6 +38,7 @@ async function createRollupConfig({
3738 externalDependencies = [ ] ,
3839 input,
3940 nodeTarget = 'current' ,
41+ withMultipleInputs,
4042 outputDir,
4143 pkgMain,
4244} : createRollupConfigOptions ) {
@@ -50,7 +52,7 @@ async function createRollupConfig({
5052 input,
5153 external : id => {
5254 // a special case for when we are importing a local index
53- if ( id === '.' ) {
55+ if ( withMultipleInputs && id === '.' ) {
5456 return true ;
5557 }
5658
@@ -102,9 +104,11 @@ async function createRollupConfig({
102104 const inputFileName = parse ( input ) . name ;
103105 const bannerFn = ( ) => banner ;
104106
105- const paths = {
106- '.' : `./${ basename ( pkgMain ) } ` ,
107- } ;
107+ const paths = { } ;
108+
109+ if ( pkgMain ) {
110+ paths [ '.' ] = `./${ basename ( pkgMain ) } ` ;
111+ }
108112
109113 const outputOptions : OutputOptions [ ] = [
110114 {
@@ -141,6 +145,8 @@ export async function bundler({
141145
142146 const inputs = await glob ( input , { absolute : true } ) ;
143147
148+ const withMultipleInputs = inputs . length > 1 ;
149+
144150 for ( let idx = 0 ; idx < inputs . length ; idx ++ ) {
145151 const input = inputs [ idx ] ;
146152
@@ -153,6 +159,7 @@ export async function bundler({
153159 externalDependencies,
154160 input,
155161 nodeTarget,
162+ withMultipleInputs,
156163 outputDir,
157164 pkgMain : pkg . main ,
158165 } ) ;
0 commit comments