Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Dec 23, 2023
1 parent 246e237 commit f14c862
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/plugins/alias-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from "rollup"
import { Plugin } from 'rollup'

// Alias entries to import path
// e.g.
Expand All @@ -8,16 +8,14 @@ export function aliasEntries({ entries }: { entries: Record<string, string>}): P
return {
name: 'alias',
resolveId: {
order: 'pre',
async handler(source, importer) {
const resolvedId = await this.resolve(source, importer)
if (resolvedId == null) {
return null
}
const aliasedId = entries[resolvedId.id]
async handler(source, importer, options) {
const resolvedId = await this.resolve(source, importer, options)
if (resolvedId != null) {
const aliasedId = entries[resolvedId.id]

if (aliasedId != null) {
return { id: aliasedId, external: true }
if (aliasedId != null) {
return { id: aliasedId, external: true }
}
}
return null
},
Expand Down

0 comments on commit f14c862

Please sign in to comment.