-
Expose
metafile
toonRebuild
in watch mode (#1057)Previously the build results returned to the watch mode
onRebuild
callback was missing themetafile
property when themetafile: true
option was present. This bug has been fixed. -
Add a
formatMessages
API (#1058)This API lets you print log messages to the terminal using the same log format that esbuild itself uses. This can be used to filter esbuild's warnings while still making the output look the same. Here's an example of calling this API:
import esbuild from 'esbuild' const formatted = await esbuild.formatMessages([{ text: '"test" has already been declared', location: { file: 'file.js', line: 2, column: 4, length: 4, lineText: 'let test = "second"' }, notes: [{ text: '"test" was originally declared here', location: { file: 'file.js', line: 1, column: 4, length: 4, lineText: 'let test = "first"' }, }], }], { kind: 'error', color: true, terminalWidth: 100, }) process.stdout.write(formatted.join(''))
-
Remove the file splitting optimization (#998)
This release removes the "file splitting optimization" that has up to this point been a part of esbuild's code splitting algorithm. This optimization allowed code within a single file to end up in separate chunks as long as that code had no side effects. For example, bundling two entry points that both use a disjoint set of code from a shared file consisting only of code without side effects would previously not generate any shared code chunks at all.
This optimization is being removed because the top-level await feature was added to JavaScript after this optimization was added, and performing this optimization in the presence of top-level await is more difficult than before. The correct evaulation order of a module graph containing top-level await is extremely complicated and is specified at the module boundary. Moving code that is marked as having no side effects across module boundaries under these additional constraints is even more complexity and is getting in the way of implementing top-level await. So the optimization has been removed to unblock work on top-level await, which esbuild must support.