Skip to content

Commit 59b0e96

Browse files
committed
fix: don't add index on some case
1 parent eb4bf8b commit 59b0e96

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function resolveEntry(
5757
}
5858

5959
function endsWithIndex(s: string) {
60-
return /(?:^|[/\\])index\..+$/.test(s)
60+
return /(?:^|[/\\])index(?:\..+)?$/.test(s)
6161
}
6262

6363
export function shouldAddIndex(id: string, resolved: string): boolean {

tests/__snapshots__/rollup/no-index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type Bar = string;
1515
```ts
1616
export {} from './foo/index.js';
1717
export {} from './index.js';
18+
export {} from './index.js';
1819

1920
```
2021
## main.js

tests/fixtures/no-index/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export {} from './foo'
22
export {} from '.'
3+
export {} from './index'

0 commit comments

Comments
 (0)