Thông tin sản phẩm
It typically defaults to the present doing work selection of the process you are having fun with to call esbuild’s API. The functional directory is utilized from the esbuild for some different some thing in addition to solving relative pathways considering because the API choices to natural pathways and you can quite-printing sheer paths as the cousin paths during the journal messages. Information about how to bypass it:
#JS-specific details
The fresh node-based JS API is available in both parallel and you can asynchronous types, for every with assorted tradeoffs. It is essential to understand variations to choose the fresh correct one for the problem:
#Connect API
- To stop claims can cause vacuum cleaner code
- Functions inside the issues that must be synchronous such as for instance in this want .extensions
- You can not play with plugins into synchronous API just like the plugins is asynchronous
- They blocks the current thread which means you are unable to create almost every other really works at the same time
- Making use of the parallel API suppresses esbuild off parallelizing esbuild API phone calls
#Async API
- You can use plugins into asynchronous API
- The present day bond isn’t prohibited to help you perform most other operate in the latest interim
- You can run of numerous multiple esbuild API phone calls in addition which are after that give across all of the readily available CPUs for optimum performance
- Using guarantees can lead to messier password, particularly in CommonJS in which finest-peak loose time waiting for isn’t available
- Can not work during the products that must definitely be synchronous instance inside need .extensions
#Powering in the browser
This new esbuild API can also run in the web browser using WebAssembly when you look at the a web Worker. When planning on taking advantage of it just be sure to establish brand new esbuild-wasm bundle instead of the esbuild plan:
Brand new API towards the browser is a lot like the API to own node other than you really need to label initialize() very first, and you should citation brand new Url of WebAssembly digital. New parallel brands of your own API are also unavailable. And in case you’re playing with an excellent bundler, that would search something similar to that it:
When you find yourself already running it password from a member of staff plus don’t need initialize in order to make various other personnel, you might citation worker: untrue in order to it. Then it will create an excellent WebAssembly component in identical thread because thread one calls initialize .
New API shall be reached in just one of 3 ways: into order line, from inside https://datingmentor.org/tr/xmatch-inceleme/ the JavaScript, and also in Go. New axioms and parameters try mainly the same within three dialects so they will be provided along with her right here instead of with separate files for each and every code.
There are two API contacts esbuild’s API: transform and build. It is critical to know what type you need to be playing with just like the they work in another way.
By using JavaScript definitely have a look at JS-particular information part below. It is possible to discover TypeScript type definitions for esbuild beneficial as a guide. If you use Go be sure to take a look at the instantly produced Go files.
If you use the newest order-line API, it may be useful to be aware that this new flags come into certainly about three models: –foo , –foo=pub , or –foo:pub . The form –foo is used to own enabling boolean flags such –minify , the proper execution –foo=club is utilized to own flags that have a single well worth and you may are only given shortly after instance –platform= , and also the function –foo:club is used to possess flags which have several values and can getting re also-specified multiple times such as for example –external: .
#Change API
The changes API telephone call operates using one string versus supply to help you a document system. This makes it perfect for include in environment instead a document system (instance an internet browser) otherwise as an element of various other unit chain. Here’s what a straightforward transform looks like: