Skip to content

Commit 5b3c6e5

Browse files
authored
fix: fix build syntax error in < node16 (#365)
1 parent f987e2c commit 5b3c6e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/esbuild/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(
6868
loader.onLoadCb = callback
6969
},
7070
onTransform(_options, callback) {
71-
loader.options ||= _options
71+
loader.options = loader.options || _options
7272
loader.onTransformCb = callback
7373
},
7474
} as EsbuildPluginBuild)
@@ -95,7 +95,7 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(
9595
break
9696
}
9797

98-
result ||= {}
98+
result = result || {}
9999

100100
for (const { options, onTransformCb } of loaders) {
101101
if (!checkFilter(options))
@@ -105,7 +105,7 @@ export function getEsbuildPlugin<UserOptions = Record<string, never>>(
105105
// caution: 'utf8' assumes the input file is not in binary.
106106
// if you want your plugin handle binary files, make sure to
107107
// `plugin.load()` them first.
108-
result.contents ||= await fs.promises.readFile(args.path, 'utf8')
108+
result.contents = result.contents || await fs.promises.readFile(args.path, 'utf8')
109109

110110
const _result = await onTransformCb({
111111
...result,

0 commit comments

Comments
 (0)