Skip to content

Commit

Permalink
fix(helper): 修复 esbuild resolve 静态资源问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed May 29, 2023
1 parent e3b632a commit b4d8279
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/taro-helper/src/esbuild/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { pick } from 'lodash'
import { resolve } from 'path'

import type { OnResolveArgs, OnResolveResult } from 'esbuild'

export function externalEsbuildModule (args: Partial<OnResolveArgs>): OnResolveResult {
export function externalEsbuildModule ({ path, namespace, importer, pluginData }: Partial<OnResolveArgs>): OnResolveResult {
if (namespace === 'file' && importer && path) {
path = resolve(importer, path)
}
return {
...pick(args, [
'path',
'namespace',
'pluginData',
]),
path,
namespace,
pluginData,
external: true
}
}

0 comments on commit b4d8279

Please sign in to comment.