This API alternative allows you to indicate the working list to utilize toward generate
They generally defaults to the present functioning list of the process you are using to mention esbuild’s API. The functional directory can be used because of the esbuild for most some other something including resolving cousin pathways given due to the fact API choices to natural routes and you may very-print pure pathways because the relative pathways inside journal texts. Here is how so you’re able to override it:
Brand new node-dependent JS API is available in each other parallel and you may asynchronous flavors, for each with different tradeoffs. It is vital to understand differences to select the latest best one for the disease:
- Avoiding guarantees may cause cleaner password
- Work inside the activities that really must be parallel including inside require .extensions
- You can not use plugins toward synchronous API because plugins is asynchronous
- It stops the current thread so you can not do other works meanwhile
- Utilizing the parallel API inhibits esbuild out of parallelizing esbuild API phone calls
- You should use plugins to the asynchronous API
- The present day thread is not banned so you’re able to do most other operate in new interim
- You can run of numerous simultaneous esbuild API phone calls concurrently which can be then pass on around the all the offered CPUs for maximum overall performance
- Using promises can cause messier code, particularly in CommonJS where top-height watch for is not available
- Doesn’t work in things that really must be parallel instance contained in this want .extensions
#Running throughout the web browser
New esbuild API may also run-in the brand new internet browser having fun with WebAssembly for the a web Employee. When deciding to take advantageous asset of it try to build this new esbuild-wasm package rather than the esbuild bundle:
The newest API to your web browser is similar to the API to possess node apart from you will want to telephone call initialize() earliest, and you ought to solution the brand new Hyperlink of the WebAssembly binary. The fresh parallel versions of your own API are also not available. Whenever you are using an excellent bundler, who lookup something such as which:
If you find yourself already powering which code of a member of staff and don’t require initialize to make various other worker, you might violation staff member: false in order to they. This may be will generate an excellent WebAssembly component in identical bond while the thread one phone calls initialize .
There are 2 API contacts esbuild’s API: alter and construct. It is important to know which you should be having fun with given that it works in another way.
If you are using brand new order-line API, it can be beneficial to remember that this new flags come into certainly one of about three versions: –foo , –foo=bar , otherwise –foo:bar . The form –foo is used to have providing boolean flags particularly –minify , the shape –foo=pub is employed to own flags that have a single really worth and you can are merely given just after eg –platform= , while the function –foo:club can be used to own flags with several viewpoints and can end up being re also-specified many times such as for instance –external: .
The brand new alter API telephone call operates on one string as opposed to availability to help you a file system. This makes it best for include in environment without a file program (such a web browser) otherwise as part of other tool chain. This is what a straightforward changes turns out: