Skip to content

Commit 65b489a

Browse files
committed
refactor: minor cleanup
1 parent d65bf64 commit 65b489a

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

bundler/bundle.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const init = async ({ platform, jest, flow, target, jestConfig, outdir, e
113113
const loader = extname(filepath).replace(/^\.[cm]?/, '')
114114
assert(['js', 'ts', 'jsx', 'tsx'].includes(loader))
115115
try {
116-
const res = await esbuild.transform(source, {
116+
const { code, warnings } = await esbuild.transform(source, {
117117
sourcemap: 'inline',
118118
sourcefile: filepath,
119119
loader,
@@ -132,11 +132,8 @@ export const init = async ({ platform, jest, flow, target, jestConfig, outdir, e
132132
using: false,
133133
},
134134
})
135-
if (res.warnings.length > 0) {
136-
console.log(...(await formatMessages(res.warnings, 'warning')))
137-
}
138-
139-
source = res.code
135+
if (warnings.length > 0) console.log(...(await formatMessages(warnings, 'warning')))
136+
source = code
140137
} catch (e) {
141138
console.log(...(await formatMessages(e.errors, 'error')))
142139
throw new Error('Transform failed', { cause: e })

0 commit comments

Comments
 (0)