esbuild 0.17.17
-
Fix CSS nesting transform for top-level
&(#3052)Previously esbuild could crash with a stack overflow when lowering CSS nesting rules with a top-level
&, such as in the code below. This happened because esbuild's CSS nesting transform didn't handle top-level&, causing esbuild to inline the top-level selector into itself. This release handles top-level&by replacing it with the:scopepseudo-class:/* Original code */ &, a { .b { color: red; } } /* New output (with --target=chrome90) */ :is(:scope, a) .b { color: red; } -
Support
exportsinpackage.jsonforextendsintsconfig.json(#3058)TypeScript 5.0 added the ability to use
extendsintsconfig.jsonto reference a path in a package whosepackage.jsonfile contains anexportsmap that points to the correct location. This doesn't automatically work in esbuild becausetsconfig.jsonaffects esbuild's path resolution, so esbuild's normal path resolution logic doesn't apply.This release adds support for doing this by adding some additional code that attempts to resolve the
extendspath using theexportsfield. The behavior should be similar enough to esbuild's main path resolution logic to work as expected.Note that esbuild always treats this
extendsimport as arequire()import since that's what TypeScript appears to do. Specifically therequirecondition will be active and theimportcondition will be inactive. -
Fix watch mode with
NODE_PATH(#3062)Node has a rarely-used feature where you can extend the set of directories that node searches for packages using the
NODE_PATHenvironment variable. While esbuild supports this too, previously a bug prevented esbuild's watch mode from picking up changes to imported files that were contained directly in aNODE_PATHdirectory. You're supposed to useNODE_PATHfor packages, but some people abuse this feature by putting files in that directory instead (e.g.node_modules/some-file.jsinstead ofnode_modules/some-pkg/some-file.js). The watch mode bug happens when you do this because esbuild first tries to readsome-file.jsas a directory and then as a file. Watch mode was incorrectly waiting forsome-file.jsto become a valid directory. This release fixes this edge case bug by changing watch mode to watchsome-file.jsas a file when this happens.