-
Implement arbitrary module namespace identifiers
This introduces new JavaScript syntax:
import {'🍕' as food} from 'file' export {food as '🧀'}
The proposal for this feature appears to not be going through the regular TC39 process. It is being done as a subtle direct pull request instead. It seems appropriate for esbuild to support this feature since it has been implemented in V8 and has now shipped in Chrome 90 and node 16.
According to the proposal, this feature is intended to improve interop with non-JavaScript languages which use exports that aren't valid JavaScript identifiers such as
Foo::~Foo
. In particular, WebAssembly allows any valid UTF-8 string as to be used as an export alias.This feature was actually already partially possible in previous versions of JavaScript via the computed property syntax:
import * as ns from './file.json' console.log(ns['🍕'])
However, doing this is very un-ergonomic and exporting something as an arbitrary name is impossible outside of
export * from
. So this proposal is designed to fully fill out the possibility matrix and make arbitrary alias names a proper first-class feature. -
Implement more accurate
sideEffects
behavior from Webpack (#1184)This release adds support for the implicit
**/
prefix that must be added to paths in thesideEffects
array inpackage.json
if the path does not contain/
. Another way of saying this is ifpackage.json
contains asideEffects
array with a string that doesn't contain a/
then it should be treated as a file name instead of a path. Previously esbuild treated all strings in this array as paths, which does not match how Webpack behaves. The result of this meant that esbuild could consider files to have no side effects while Webpack would consider the same files to have side effects. This bug should now be fixed.