Skip to content

Commit

Permalink
fix: don't add index on some case
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 13, 2025
1 parent eb4bf8b commit 59b0e96
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function resolveEntry(
}

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

export function shouldAddIndex(id: string, resolved: string): boolean {
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/rollup/no-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type Bar = string;
```ts
export {} from './foo/index.js';
export {} from './index.js';
export {} from './index.js';

```
## main.js
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/no-index/main.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export {} from './foo'
export {} from '.'
export {} from './index'

0 comments on commit 59b0e96

Please sign in to comment.