Skip to content

Commit

Permalink
refactor: support unplugin v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Dec 27, 2024
1 parent d612dd1 commit 944ffc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ const unplugin: UnpluginInstance<Options | undefined, false> = createUnplugin(
let contents = await readFile(file, 'utf-8')
if (transformFilter(file)) {
let transform: typeof import('esbuild').transform
if (meta.framework === 'esbuild') {
;({ transform } = meta.build!.esbuild)
const nativeContext = this.getNativeBuildContext?.()
if (nativeContext?.framework === 'esbuild') {
;({ transform } = nativeContext.build.esbuild)
} else {
transform = (await import('esbuild')).transform
}
Expand Down

0 comments on commit 944ffc4

Please sign in to comment.