esbuild 0.18.12
-
Fix a panic with
const enuminside parentheses (#3205)This release fixes an edge case where esbuild could potentially panic if a TypeScript
const enumstatement 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 typestatement (#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 typeis 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
.jsto.tsinside packages withexports(#3201)Packages with the
exportsfield 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/barto getfoo/bar.js). And TypeScript has behavior where you can import a non-existent.jsfile and you will get the.tsfile instead. Previously the presence of theexportsfield 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.jsto.tseven 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
/aboutredirects to/about/if/about/index.htmlwould be served. However, if the requested path begins with two slashes, then the redirect incorrectly turned into a protocol-relative URL. For example, visiting//aboutredirected to//about/which the browser turns intohttp://about/. This release fixes the bug by canonicalizing the URL path when doing this redirect.