esbuild 0.15.17
-
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
sourcesContentarray, esbuild would usenullfor 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 thesourcesarray and will use that instead ofnullif it was found. -
Fix parsing bug with TypeScript
inferandextends(#2712)This release fixes a bug where esbuild incorrectly failed to parse valid TypeScript code that nests
extendsinsideinferinsideextends, 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.instantiateStreamingif available (#1036, #1900)Currently the WebAssembly version of esbuild uses
fetchto downloadesbuild.wasmand thenWebAssembly.instantiateto compile it. There is a newer API calledWebAssembly.instantiateStreamingthat 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.instantiateStreamingand 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.