v0.16.7
-
Include
file
loader strings in metafile imports (#2731)Bundling a file with the
file
loader copies that file to the output directory and imports a module with the path to the copied file in thedefault
export. Previously when bundling with thefile
loader, there was no reference in the metafile from the JavaScript file containing the path string to the copied file. With this release, there will now be a reference in the metafile in theimports
array with the kindfile-loader
:{ ... "outputs": { "out/image-55CCFTCE.svg": { ... }, "out/entry.js": { "imports": [ + { + "path": "out/image-55CCFTCE.svg", + "kind": "file-loader" + } ], ... } } }
-
Fix byte counts in metafile regarding references to other output files (#2071)
Previously files that contained references to other output files had slightly incorrect metadata for the byte counts of input files which contributed to that output file. So for example if
app.js
importsimage.png
using the file loader and esbuild generatesout.js
andimage-LSAMBFUD.png
, the metadata for how many bytes ofout.js
are fromapp.js
was slightly off (the metadata for the byte count ofout.js
was still correct). The reason is because esbuild substitutes the final paths for references between output files toward the end of the build to handle cyclic references, and the byte counts needed to be adjusted as well during the path substitution. This release fixes these byte counts (specifically thebytesInOutput
values). -
The alias feature now strips a trailing slash (#2730)
People sometimes add a trailing slash to the name of one of node's built-in modules to force node to import from the file system instead of importing the built-in module. For example, importing
util
imports node's built-in module calledutil
but importingutil/
tries to find a package calledutil
on the file system. Previously attempting to use esbuild's package alias feature to replace imports toutil
with a specific file would fail because the file path would also gain a trailing slash (e.g. mappingutil
to./file.js
turnedutil/
into./file.js/
). With this release, esbuild will now omit the path suffix if it's a single trailing slash, which should now allow you to successfully apply aliases to these import paths.