esbuild 0.11.2
-
Fix missing symbol dependency for wrapped ESM files (#1086)
An internal graph node was missing an edge, which could result in generating code that crashes at run-time when code splitting is enabled. Specifically a part containing an import statement must depend on the imported file's wrapper symbol if the imported file is wrapped, regardless of whether it's a wrapped CommonJS or ESM file. Previously this was only the case for CommonJS files but not for ESM files, which is incorrect. This bug has been fixed.
-
Fix an edge case with entry points and top-level await
If an entry point uses
import()on itself, it currently has to be wrapped sinceimport()expressions call the wrapper for the imported file. This means the another call to the wrapper must be inserted at the bottom of the entry point file to start the lazy evaluation of the entry point code (otherwise nothing will be evaluated, since the entry point is wrapped). However, if this entry point then contains a top-level await that means the wrapper isasyncand must be passed toawaitto catch and forward any exceptions thrown during the evaluation of the entry point code. Thisawaitwas previously missing in this specific case due to a bug, but theawaitshould now be added in this release.