github evanw/esbuild v0.11.1

latest releases: v0.20.2, v0.20.1, v0.20.0...
3 years ago
  • Fix a missing space before internal import() when minifying (#1082)

    Internal import() of a CommonJS module inside the bundle turns into a call to Promise.resolve().then(() => require()). However, a space was not inserted before the Promise token when minifying, which could lead to a syntax error. This bug has been fixed.

  • Fix code generation for unused imported files without side effects (#1080)

    When esbuild adds a wrapping closure around a file to turn it from a statically-initialized file to a dynamically-initialized file, it also needs to turn import statements in other files that import the wrapped file into calls to the wrapper so that the wrapped file is initialized in the correct ordering. However, although tree-shaking is disabled for wrapped CommonJS files because CommonJS exports are dynamic, tree-shaking is still enabled for wrapped ESM files because ESM exports are static.

    This caused a bug when files that have been marked with "sideEffects": false end up being completely unused in the resulting bundle. In that case the file is removed entirely, but esbuild was still turning import statements to that file into calls to the ESM wrapper. These wrapper calls should instead be omitted if the file was completely removed from the bundle as dead code. This bug has been fixed.

  • Allow top-level await in supported environments

    Top-level await (i.e. using the await keyword outside of an async function) is not yet part of the JavaScript language standard. The feature proposal is still at stage 3 and has not yet advanced to stage 4. However, V8 has already implemented it and it has shipped in Chrome 89 and node 14.8. This release allows top-level await to be used when the --target= flag is set to those compilation targets.

  • Convert import() to require() if import() is not supported (#1084)

    This release now converts dynamic import() expressions into Promise.resolve().then(() => require()) expressions if the compilation target doesn't support them. This is the case for node before version 13.2, for example.

Don't miss a new esbuild release

NewReleases is sending notifications on new releases.