-
Fix a panic with
const enum
inside parentheses (#3205)This release fixes an edge case where esbuild could potentially panic if a TypeScript
const enum
statement was used inside of a parenthesized expression and was followed by certain other scope-related statements. Here's a minimal example that triggers this edge case:(() => { const enum E { a }; () => E.a })
-
Allow a newline in the middle of TypeScript
export type
statement (#3225)Previously esbuild incorrectly rejected the following valid TypeScript code:
export type { T }; export type * as foo from 'bar';
Code that uses a newline after
export type
is now allowed starting with this release. -
Fix cross-module inlining of string enums (#3210)
A refactoring typo in version 0.18.9 accidentally introduced a regression with cross-module inlining of string enums when combined with computed property accesses. This regression has been fixed.
-
Rewrite
.js
to.ts
inside packages withexports
(#3201)Packages with the
exports
field are supposed to disable node's path resolution behavior that allows you to import a file with a different extension than the one in the source code (for example, importingfoo/bar
to getfoo/bar.js
). And TypeScript has behavior where you can import a non-existent.js
file and you will get the.ts
file instead. Previously the presence of theexports
field caused esbuild to disable all extension manipulation stuff which included both node's implicit file extension searching and TypeScript's file extension swapping. However, TypeScript appears to always apply file extension swapping even in this case. So with this release, esbuild will now rewrite.js
to.ts
even inside packages withexports
. -
Fix a redirect edge case in esbuild's development server (#3208)
The development server canonicalizes directory URLs by adding a trailing slash. For example, visiting
/about
redirects to/about/
if/about/index.html
would be served. However, if the requested path begins with two slashes, then the redirect incorrectly turned into a protocol-relative URL. For example, visiting//about
redirected to//about/
which the browser turns intohttp://about/
. This release fixes the bug by canonicalizing the URL path when doing this redirect.