diff --git a/src/esbuild/index.ts b/src/esbuild/index.ts index df7390d4..fa752977 100644 --- a/src/esbuild/index.ts +++ b/src/esbuild/index.ts @@ -72,7 +72,7 @@ export function getEsbuildPlugin>( loader.options ||= _options loader.onTransformCb = callback }, - } as EsbuildPluginBuild) + } as EsbuildPluginBuild, build) // skip if no load & transform hooks if (loader.onLoadCb || loader.onTransformCb) @@ -141,9 +141,8 @@ export function getEsbuildPlugin>( } function buildSetup() { - return (plugin: UnpluginOptions): EsbuildPlugin['setup'] => { - return (rawBuild) => { - const build = rawBuild as EsbuildPluginBuild + return (plugin: UnpluginOptions) => { + return (build: EsbuildPluginBuild, rawBuild: PluginBuild) => { const context = createBuildContext(build) const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions } = build