Skip to content

Commit

Permalink
feat(utils): name used import on duplicate on warning (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli authored Sep 6, 2023
1 parent 5ad2b37 commit 28cf011
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function dedupeImports (imports: Import[], warn: (msg: string) => void) {
}
const diff = (other.priority || 1) - (i.priority || 1)
if (diff === 0) {
warn(`Duplicated imports "${name}", the one from "${other.from}" has been ignored`)
warn(`Duplicated imports "${name}", the one from "${other.from}" has been ignored and "${i.from}" is used`)
}
if (diff <= 0) {
indexToRemove.add(map.get(name)!)
Expand Down
2 changes: 1 addition & 1 deletion test/dedupe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('dedupeImports', () => {
]
`)

expect(warnMsg).toMatchInlineSnapshot('"Duplicated imports \\"foo\\", the one from \\"module1\\" has been ignored"')
expect(warnMsg).toMatchInlineSnapshot('"Duplicated imports \\"foo\\", the one from \\"module1\\" has been ignored and \\"module2\\" is used"')
})

it('respect explit priority', () => {
Expand Down

0 comments on commit 28cf011

Please sign in to comment.