Skip to content

Inconsistent builds when running in parallel on same service

I'm running into a weird issue, and I'm still investigating the origin: I'm building a code base with multiple bundles, and use esbuild as a Node library to build all of them, but when building the bundles in parallel I'm getting inconsistent result:

  • 💥 Running 7 builds in parallel using the same esbuild service => one of them is missing a defined variable (passed in define)
  • Running the same builds in serie using the same esbuild service => all good
  • Running the same builds in parallel using different esbuild service for each build => all good

I've investigated if it was coming from a mutation of options on my code, but it's not the case. I've took a look at the implementation of the Node API, but couldn't find any code that is not "async safe".

To validate both, I've logged the length being sent to the esbuild binary, and I'm getting consistent lengths (whatever the method being used).

From my current understanding it looks like an issue in the Go binary when receiving multiple commands. Is it a known limitation ?

I can reproduce the issue, but cannot really share the codebase as it's private.