-
Preserve URL fragments in data URLs (#4370)
Consider the following HTML, CSS, and SVG:
-
index.html:<!DOCTYPE html> <html> <head><link rel="stylesheet" href="icons.css"></head> <body><div class="triangle"></div></body> </html>
-
icons.css:.triangle { width: 10px; height: 10px; background: currentColor; clip-path: url(./triangle.svg#x); }
-
triangle.svg:<svg xmlns="http://www.w3.org/2000/svg"> <defs> <clipPath id="x"> <path d="M0 0H10V10Z"/> </clipPath> </defs> </svg>
The CSS uses a URL fragment (the
#x) to reference theclipPathelement in the SVG file. Previously esbuild's CSS bundler didn't preserve the URL fragment when bundling the SVG using thedataurlloader, which broke the bundled CSS. With this release, esbuild will now preserve the URL fragment in the bundled CSS:/* icons.css */ .triangle { width: 10px; height: 10px; background: currentColor; clip-path: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="x"><path d="M0 0H10V10Z"/></clipPath></defs></svg>#x'); }
-
-
Parse and print CSS
@scoperules (#4322)This release includes dedicated support for parsing
@scoperules in CSS. These rules include optional "start" and "end" selector lists. One important consequence of this is that the local/global status of names in selector lists is now respected, which improves the correctness of esbuild's support for CSS modules. Minification of selectors inside@scoperules has also improved slightly.Here's an example:
/* Original code */ @scope (:global(.foo)) to (:local(.bar)) { .bar { color: red; } } /* Old output (with --loader=local-css --minify) */ @scope (:global(.foo)) to (:local(.bar)){.o{color:red}} /* New output (with --loader=local-css --minify) */ @scope(.foo)to (.o){.o{color:red}}
-
Fix a minification bug with lowering of
for await(#4378, #4385)This release fixes a bug where the minifier would incorrectly strip the variable in the automatically-generated
catchclause of loweredfor awaitloops. The code that generated the loop previously failed to mark the internal variable references as used. -
Update the Go compiler from v1.25.5 to v1.25.7 (#4383, #4388)
This PR was contributed by @MikeWillCook.