So it API choice lets you specify the functional index to make use of with the generate

So it API choice lets you specify the functional index to make use of with the generate

They generally defaults to the present performing selection of the method you’re playing with to-name esbuild’s API. The working directory is utilized by the esbuild for many some other something and fixing cousin routes considering given that API choices to pure routes and you can rather-print sheer paths once the cousin paths when you look at the diary texts. Information on how so you’re able to override they:

#JS-specific information

The fresh node-dependent JS API comes in each other synchronous and you will asynchronous styles, per with various tradeoffs. You will need to be aware of the variations to select the fresh best one to suit your condition:

#Connect API

  • To prevent claims can result in cleaner password
  • Performs in the items that must be parallel such as for example in this need .extensions
  • You can not explore plugins into the parallel API since the plugins are asynchronous
  • They reduces the modern bond you can not carry out other performs in the meantime
  • Utilising the parallel API prevents esbuild out-of parallelizing esbuild API phone calls

#Async API

  • You can utilize plugins into asynchronous API
  • The modern bond is not blocked so you can perform most other operate in new meantime
  • You could work on many parallel esbuild API phone calls on the other hand that are then give all over every available CPUs for optimum results
  • Playing with guarantees can lead to messier password, particularly in CommonJS where greatest-peak wait a little for isn’t available
  • Can not work inside the activities that really must be parallel eg within this require .extensions

#Powering on browser

New esbuild API also can run in new web browser having fun with WebAssembly into the an internet Personnel. When deciding to take advantageous asset of so it make an effort to build the brand new esbuild-wasm package as opposed to the esbuild bundle:

The latest API with the browser is a lot like the brand new API getting node besides you should telephone call initialize() earliest, and you need to citation the latest Hyperlink of WebAssembly digital. This new synchronous brands of API are unavailable. Of course you’re playing with an excellent bundler, who would browse something similar to which:

If you are currently running that it code out of an employee plus don’t want initialize to make other staff, you could potentially solution personnel: not the case to help you it. It can establish a great WebAssembly component in identical bond as bond that phone calls initialize .

This new API would be utilized in another of three ways: on the demand range, when you look at the JavaScript, plus Wade. New axioms and parameters is mostly identical between the around three dialects so they really will be provided together here as opposed to which have independent documentation each vocabulary.

There have been two API calls in esbuild’s API: alter and build. It’s important to understand which one you should be playing with given that it works in a different way.

By using JavaScript be sure to take a look at JS-particular information part below. You can even discover the TypeScript types of meanings for esbuild of use once the a guide. If you use Go definitely take a look at the automatically made Wade paperwork.

If you utilize the latest demand-line API, it could be helpful to remember that the flags are located in among around three models: –foo , –foo=pub , otherwise –foo:club . The form –foo is employed getting providing boolean flags eg –minify , the form –foo=bar is used to possess flags with one worthy of and you will are just given shortly after for example –platform= , in addition to means –foo:bar is used having flags which have multiple viewpoints and certainly will getting re-given multiple times eg –external: .

#Changes API

The latest change API label works on one sequence rather than availability to help you a file system. This will make it perfect for include in surroundings as opposed to a document system (like a browser) or included in another tool chain. This is what a straightforward change works out:

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *