-
Search for missing source map code on the file system (#2711)
Source maps are JSON files that map from compiled code back to the original code. They provide the original source code using two arrays:
sources
(required) andsourcesContent
(optional). When bundling is enabled, esbuild is able to bundle code with source maps that was compiled by other tools (e.g. with Webpack) and emit source maps that map all the way back to the original code (e.g. before Webpack compiled it).Previously if the input source maps omitted the optional
sourcesContent
array, esbuild would usenull
for the source content in the source map that it generates (since the source content isn't available). However, sometimes the original source code is actually still present on the file system. With this release, esbuild will now try to find the original source code using the path in thesources
array and will use that instead ofnull
if it was found. -
Fix parsing bug with TypeScript
infer
andextends
(#2712)This release fixes a bug where esbuild incorrectly failed to parse valid TypeScript code that nests
extends
insideinfer
insideextends
, such as in the example below:type A<T> = {}; type B = {} extends infer T extends {} ? A<T> : never;
TypeScript code that does this should now be parsed correctly.
-
Use
WebAssembly.instantiateStreaming
if available (#1036, #1900)Currently the WebAssembly version of esbuild uses
fetch
to downloadesbuild.wasm
and thenWebAssembly.instantiate
to compile it. There is a newer API calledWebAssembly.instantiateStreaming
that both downloads and compiles at the same time, which can be a performance improvement if both downloading and compiling are slow. With this release, esbuild now attempts to useWebAssembly.instantiateStreaming
and falls back to the original approach if that fails.The implementation for this builds on a PR by @lbwa.
-
Preserve Webpack comments inside constructor calls (#2439)
This improves the use of esbuild as a faster TypeScript-to-JavaScript frontend for Webpack, which has special magic comments inside
new Worker()
expressions that affect Webpack's behavior.