For example, it is of good use while using a document watcher services

For example, it is of good use while using a document watcher services

You may use this API in case your have fun with case relates to contacting esbuild’s build API many times with the exact same possibilities. Progressive creates be a little more effective than normal produces given that the the content is cached and will feel reused in the event the brand new records have not changed because the history build. Discover currently two kinds of caching used by the brand new progressive create API:

Data files are stored in memories and are not re-see on document system in case the file metadata have not altered given that last create. So it optimization just relates to file program pathways. It will not affect digital modules developed by plugins.

Parsed ASTs was stored in memories and you may re also-parsing the fresh AST is actually eliminated if your document articles haven’t changed since the history build. So it optimisation applies to virtual modules created by plugins on top of that so you can document program modules, provided this new virtual component roadway remains the same.

This option informs esbuild how to handle JSX syntax. You may either features esbuild alter JSX in order to JS (the new standard) or manage the latest JSX syntax throughout the production. To preserve JSX sentence structure:

Observe that for folks who keep JSX syntax, the newest productivity data files are no offered good JavaScript password. This particular aspect will be utilized if you want so you can transform the fresh new JSX sentence structure into the esbuild’s yields records by the another device shortly after bundling, constantly you to which have another type of JSX-to-JS transform than the you to esbuild tools.

#JSX facility

You can call things other than Respond.createElement by the altering the fresh JSX facility. Such as for instance, to mention the event h as an alternative (which is used from the other libraries including Preact):

Alternatively, if you utilize TypeScript, you can simply arrange JSX getting TypeScript by the addition of this to help you your own tsconfig mylol desteДџi.json document and esbuild will be pick it up immediately without the need for getting set up:

#JSX fragment

You can utilize a feature aside from Work.Fragment from the switching the fresh JSX fragment. Particularly, to make use of this new role Fragment rather (which is used by the almost every other libraries eg Preact):

Instead, when you use TypeScript, you can just configure JSX getting TypeScript adding that it so you’re able to the tsconfig.json file and you may esbuild will be figure it out instantly without the need for are set up:

#Keep brands

During the JavaScript title assets into properties and you can categories defaults to the neighborhood identifier throughout the origin password. This type of syntax models all set title assets of means so you’re able to “fn” :

However, minification renames signs to minimize code proportions and you may bundling often need so you’re able to rename signs to cease crashes. You to definitely change value of the name possessions for most of those instances. this is okay given that identity house is normally just useful for debugging. Yet not, some tissues believe in title property to have subscription and you will joining aim. Should this be possible, you can permit this option in preserving the first label thinking despite minified password:

#Legal statements

A great “legal feedback” is considered to be one declaration-level comment during the JS or signal-height opinion in CSS that has had otherwise or you to begins with //! otherwise /*! . These types of statements try preserved during the returns records by default while the that uses the brand new intention of one’s original article writers of your own code. But not, this decisions might be set up that with among the many after the options:

The newest default behavior are eof when plan are allowed and you may inline otherwise. Function the fresh judge comment setting ends up this:

Remember that “statement-level” having JS and you will “rule-level” to have CSS function new comment have to appear in a perspective in which numerous statements otherwise regulations are permitted such on top-height range or even in a statement or laws block. Therefore comments to the words otherwise from the declaration peak are not experienced permit statements.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *