@@ -28,6 +28,7 @@ interface createRollupConfigOptions {
28
28
externalDependencies ?: string [ ] ;
29
29
input : string ;
30
30
nodeTarget ?: string ;
31
+ withMultipleInputs : boolean ;
31
32
outputDir : string ;
32
33
pkgMain : string ;
33
34
}
@@ -37,6 +38,7 @@ async function createRollupConfig({
37
38
externalDependencies = [ ] ,
38
39
input,
39
40
nodeTarget = 'current' ,
41
+ withMultipleInputs,
40
42
outputDir,
41
43
pkgMain,
42
44
} : createRollupConfigOptions ) {
@@ -50,7 +52,7 @@ async function createRollupConfig({
50
52
input,
51
53
external : id => {
52
54
// a special case for when we are importing a local index
53
- if ( id === '.' ) {
55
+ if ( withMultipleInputs && id === '.' ) {
54
56
return true ;
55
57
}
56
58
@@ -102,9 +104,11 @@ async function createRollupConfig({
102
104
const inputFileName = parse ( input ) . name ;
103
105
const bannerFn = ( ) => banner ;
104
106
105
- const paths = {
106
- '.' : `./${ basename ( pkgMain ) } ` ,
107
- } ;
107
+ const paths = { } ;
108
+
109
+ if ( pkgMain ) {
110
+ paths [ '.' ] = `./${ basename ( pkgMain ) } ` ;
111
+ }
108
112
109
113
const outputOptions : OutputOptions [ ] = [
110
114
{
@@ -141,6 +145,8 @@ export async function bundler({
141
145
142
146
const inputs = await glob ( input , { absolute : true } ) ;
143
147
148
+ const withMultipleInputs = inputs . length > 1 ;
149
+
144
150
for ( let idx = 0 ; idx < inputs . length ; idx ++ ) {
145
151
const input = inputs [ idx ] ;
146
152
@@ -153,6 +159,7 @@ export async function bundler({
153
159
externalDependencies,
154
160
input,
155
161
nodeTarget,
162
+ withMultipleInputs,
156
163
outputDir,
157
164
pkgMain : pkg . main ,
158
165
} ) ;
0 commit comments