-
Fix a parser hang on invalid CSS (#2276)
Previously invalid CSS with unbalanced parentheses could cause esbuild's CSS parser to hang. An example of such an input is the CSS file
:x(
. This hang has been fixed. -
Add support for custom log message levels
This release allows you to override the default log level of esbuild's individual log messages. For example, CSS syntax errors are treated as warnings instead of errors by default because CSS grammar allows for rules containing syntax errors to be ignored. However, if you would like for esbuild to consider CSS syntax errors to be build errors, you can now configure that like this:
-
CLI
$ esbuild example.css --log-override:css-syntax-error=error
-
JS API
let result = await esbuild.build({ entryPoints: ['example.css'], logOverride: { 'css-syntax-error': 'error', }, })
-
Go API
result := api.Build(api.BuildOptions{ EntryPoints: []string{"example.ts"}, LogOverride: map[string]api.LogLevel{ "css-syntax-error": api.LogLevelError, }, })
You can also now use this feature to silence warnings that you are not interested in. Log messages are referred to by their identifier. Each identifier is stable (i.e. shouldn't change over time) except there is no guarantee that the log message will continue to exist. A given log message may potentially be removed in the future, in which case esbuild will ignore log levels set for that identifier. The current list of supported log level identifiers for use with this feature can be found below:
JavaScript:
assign-to-constant
call-import-namespace
commonjs-variable-in-esm
delete-super-property
direct-eval
duplicate-case
duplicate-object-key
empty-import-meta
equals-nan
equals-negative-zero
equals-new-object
html-comment-in-js
impossible-typeof
private-name-will-throw
semicolon-after-return
suspicious-boolean-not
this-is-undefined-in-esm
unsupported-dynamic-import
unsupported-jsx-comment
unsupported-regexp
unsupported-require-call
CSS:
css-syntax-error
invalid-@charset
invalid-@import
invalid-@nest
invalid-@layer
invalid-calc
js-comment-in-css
unsupported-@charset
unsupported-@namespace
unsupported-css-property
Bundler:
different-path-case
ignored-bare-import
ignored-dynamic-import
import-is-undefined
package.json
require-resolve-not-external
tsconfig.json
Source maps:
invalid-source-mappings
sections-in-source-map
missing-source-map
unsupported-source-map-comment
Documentation about which identifiers correspond to which log messages will be added in the future, but hasn't been written yet. Note that it's not possible to configure the log level for a build error. This is by design because changing that would cause esbuild to incorrectly proceed in the building process generate invalid build output. You can only configure the log level for non-error log messages (although you can turn non-errors into errors).
-