v0.17.7
-
Change esbuild's parsing of TypeScript instantiation expressions to match TypeScript 4.8+ (#2907)
This release updates esbuild's implementation of instantiation expression erasure to match microsoft/TypeScript#49353. The new rules are as follows (copied from TypeScript's PR description):
When a potential type argument list is followed by
- a line break,
- an
(
token, - a template literal string, or
- any token except
<
or>
that isn't the start of an expression,
we consider that construct to be a type argument list. Otherwise we consider the construct to be a
<
relational expression followed by a>
relational expression. -
Ignore
sideEffects: false
for imported CSS files (#1370, #1458, #2905)This release ignores the
sideEffects
annotation inpackage.json
for CSS files that are imported into JS files using esbuild'scss
loader. This means that these CSS files are no longer be tree-shaken.Importing CSS into JS causes esbuild to automatically create a CSS entry point next to the JS entry point containing the bundled CSS. Previously packages that specified some form of
"sideEffects": false
could potentially cause esbuild to consider one or more of the JS files on the import path to the CSS file to be side-effect free, which would result in esbuild removing that CSS file from the bundle. This was problematic because the removal of that CSS is outwardly observable, since all CSS is global, so it was incorrect for previous versions of esbuild to tree-shake CSS files imported into JS files. -
Add constant folding for certain additional equality cases (#2394, #2895)
This release adds constant folding for expressions similar to the following:
// Original input console.log( null === 'foo', null === undefined, null == undefined, false === 0, false == 0, 1 === true, 1 == true, ) // Old output console.log( null === "foo", null === void 0, null == void 0, false === 0, false == 0, 1 === true, 1 == true ); // New output console.log( false, false, true, false, true, false, true );