Skip to content

Commit

Permalink
fix(esbuild): execute both unplugin and esbuild-specific hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Aug 7, 2024
1 parent 95fbbd2 commit 3e2fa72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/esbuild/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(

function buildSetup(meta: UnpluginContextMeta & { framework: 'esbuild' }) {
return (plugin: UnpluginOptions): EsbuildPlugin['setup'] => {
if (plugin.esbuild?.setup)
return plugin.esbuild.setup as EsbuildPlugin['setup']

return (build) => {
meta.build = build as EsbuildPluginBuild
const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions }
Expand Down Expand Up @@ -308,6 +305,9 @@ function buildSetup(meta: UnpluginContextMeta & { framework: 'esbuild' }) {
}
})
}

if (plugin.esbuild?.setup)
return plugin.esbuild.setup(meta.build)
}
}
}

0 comments on commit 3e2fa72

Please sign in to comment.