Skip to content

Commit

Permalink
fix(esbuild): sourcemaps in transform result can be a string (#377)
Browse files Browse the repository at this point in the history
* Fix esbuild when transform result is a string

* Also fix it in if clause above
  • Loading branch information
snowystinger committed Mar 29, 2024
1 parent 867b71d commit 4382fa2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/esbuild/index.ts
Expand Up @@ -279,13 +279,18 @@ function buildSetup(meta: UnpluginContextMeta & { framework: 'esbuild' }) {
// combine the two sourcemaps
if (map && result.map) {
map = combineSourcemaps(args.path, [
result.map as RawSourceMap,
result.map === 'string' ? JSON.parse(result.map) : result.map as RawSourceMap,
map as RawSourceMap,
]) as SourceMap
}
else {
// otherwise, we always keep the last one, even if it's empty
map = result.map as any
if (typeof result.map === 'string') {
map = JSON.parse(result.map)
}
else {
// otherwise, we always keep the last one, even if it's empty
map = result.map as SourceMap
}
}
}

Expand Down

0 comments on commit 4382fa2

Please sign in to comment.