You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is an issue in ESBuild or in Angular CLI, but the JS-bundles created end up still having comments like:
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
According to the docs and this comment, they should be removed by default?
You are correct, esbuild does not preserve comments. It's not built to preserve comments. Preserving comments means it would operate more like a code formatter than a compiler. For example, you would probably want a token spanning tree instead of an AST. Doing this is currently a non-goal of esbuild. You should probably be using another tool for this.
The text was updated successfully, but these errors were encountered:
mirobo
changed the title
You are correct, esbuild does not preserve comments. It's not built to preserve comments. Preserving comments means it would operate more like a code formatter than a compiler. For example, you would probably want a token spanning tree instead of an AST. Doing this is currently a non-goal of esbuild. You should probably be using another tool for this.
Comments are not removed in build with Angular ESBuild
Jan 12, 2024
Since then, comment preservation was added for more kinds of comments. See also #2721 and v0.16.14. There is still no guarantee that esbuild will preserve all comments but it does now make an attempt to preserve comments in certain AST locations that are important for the major tools that use esbuild as a TypeScript transformation step.
Hey there
I'm not sure if this is an issue in ESBuild or in Angular CLI, but the JS-bundles created end up still having comments like:
According to the docs and this comment, they should be removed by default?
Originally posted by @evanw in #516 (comment)
Also this comment doesn't contain
@preserve
,@license
,//!
or/*!
.. so it should be a "normal" comment, that should be removed?Versions:
Node: 20.10.0 (Windows 10)
ESbuild: 0.19.5
Angular: 17.0.8
The text was updated successfully, but these errors were encountered: