You may make use of this API in the event your use situation involves calling esbuild’s create API a couple of times with similar alternatives. Progressive makes are more efficient than simply normal creates since the a number of the info are cached and can be reused if for example the brand spanking new data have not changed given that last generate. There are currently two different caching utilized by new progressive create API:
Files are kept in memories as they are not re-understand regarding file system if the document metadata has not yet altered given that last generate. Which optimization merely applies to document program paths. It does not affect digital segments developed by plugins.
Parsed ASTs are kept in recollections and you may re also-parsing the AST is avoided when your document content material haven’t changed as the last make. Which optimization relates to virtual modules produced by plugins at exactly the same time so you can document program modules, so long as the new digital component roadway remains the exact same.
This informs esbuild how to handle JSX sentence structure. You can either has esbuild transform JSX to JS (the brand new default) otherwise keep the JSX syntax from the yields. To preserve JSX syntax:
Remember that for those who keep JSX syntax, this new efficiency files are no stretched legitimate JavaScript password. This particular aspect will be utilized if you want to transform the new JSX syntax for the esbuild’s production records by some other unit immediately following bundling, usually one to that have a unique JSX-to-JS alter compared to you to definitely esbuild executes.
#JSX warehouse
You can label one thing except that Function.createElement because of the modifying the fresh JSX warehouse. For example, to mention the event h alternatively (that is used from the almost every other libraries including Preact):
Instead, when you use TypeScript, you can simply arrange JSX to possess TypeScript by adding it so you’re able to their tsconfig.json document and you can esbuild is to pick it up immediately without needing to be set up:
#JSX fragment
You can utilize a component besides Behave.Fragment by the altering new JSX fragment. Particularly, to make use of the component Fragment rather (that is used by the other libraries instance Preact):
Instead, if you use TypeScript, you can just arrange JSX to own TypeScript by the addition of so it so you can your tsconfig.json document and you may esbuild will be pick it up automatically without needing to get configured:
#Keep labels
From inside the JavaScript title assets towards the services and you may categories non-payments to a nearby identifier on the origin password. These types of sentence structure versions all set to go title property of one’s setting so you can “fn” :
But not, minification renames symbols to reduce code size and you will bundling either you need to help you rename signs to get rid of collisions. That change property value the name property for some of these circumstances. It’s usually fine just like the name house is generally simply employed for debugging. not, certain architecture trust the name possessions to possess registration and you may joining aim. If this sounds like the scenario, you might allow this in preserving the initial identity thinking even in minified password:
#Courtroom statements
A beneficial “judge feedback” is considered to be one declaration-peak comment for the JS otherwise rule-peak feedback when you look at the CSS which has had or otherwise that begins with //! otherwise /*! . This type of comments is managed in output documents automagically since the you to definitely follows the fresh new purpose of the original article writers of your own password. However, that it decisions might be hop over to this web-site configured by using among the following the options:
The fresh new standard conclusion try eof whenever package are enabled and you will inline or even. Setting the latest courtroom feedback means ends up which:
Note that “statement-level” having JS and you can “rule-level” having CSS setting brand new comment must appear in a context where several statements or laws and regulations are allowed particularly about most useful-height extent or perhaps in an announcement otherwise laws cut off. Therefore statements into the phrases otherwise from the declaration top are not felt license statements.