This API alternative enables you to specify the functional index to utilize to your generate

Written by on September 26, 2022

This API alternative enables you to specify the functional index to utilize to your generate

It generally speaking non-payments to the present performing variety of the procedure you’re using to mention esbuild’s API. The working directory is used because of the esbuild for some some other some thing plus resolving relative routes given once the API options to pure pathways and you can pretty-print sheer paths because the cousin paths in journal texts. Information about how in order to override it:

#JS-particular info

The node-centered JS API comes in both parallel and you can asynchronous styles, for each and every with different tradeoffs. It is important to be aware of the distinctions to pick brand new correct one to suit your state:

#Sync API

  • To stop pledges may cause vacuum password
  • Functions in the situations that must be synchronous such as contained in this require .extensions
  • You can not fool around with plugins on the parallel API just like the plugins are asynchronous
  • They prevents the current bond you cannot do almost every other work meanwhile
  • Using the synchronous API prevents esbuild away from parallelizing esbuild API phone calls

#Async API

  • You can make use of plugins to your asynchronous API
  • The current bond isn’t blocked in order to perform most other operate in the fresh new meantime
  • You could potentially work on of numerous simultaneous esbuild API phone calls on top of that that are then pass on round the all of the offered CPUs for optimum performance
  • Using claims can result in messier password, especially in CommonJS where ideal-level anticipate isn’t offered
  • Doesn’t work in situations that must be synchronous such as for example in this wanted .extensions

#Running regarding internet browser

Brand new esbuild API may also run in the newest web browser using WebAssembly during the an internet Employee. For taking advantageous asset of that it attempt to set up brand new esbuild-wasm plan as opposed to the esbuild package:

The newest API into web browser is like this new API to possess node except that you need to name initialize() very first, and you ought to solution the Website link of the WebAssembly digital. New synchronous items of your own API are unavailable. And in case you’re playing with a good bundler, who look something similar to that it:

Whenever you are currently powering which password regarding a worker plus don’t require initialize which will make another worker, you can ticket staff member: false to help you they. It will create an excellent WebAssembly module in the same bond since the thread you to definitely calls initialize .

The brand new API are going to be utilized in another of three straight ways: into the demand range, when you look at the JavaScript, and in Go. This new basics and you can parameters was mostly the same between your about three languages so they will be provided together right here rather than with separate papers for each and every vocabulary.

There’s two API calls in esbuild’s API: alter and construct. You will need to know what type you need to be playing with due to the fact they work in another way.

If you are using JavaScript be sure to check out the JS-certain information point lower than. It is possible to select the TypeScript form of meanings to own esbuild of good use given that a guide. If you utilize Go make sure you take a look at immediately produced Go files.

If you use the newest demand-line API, it could be helpful to be aware that the brand new flags can be found in certainly one of around three variations: –foo , –foo=club , otherwise –foo:club . The shape –foo is employed to own helping boolean flags instance –minify , the design xmeets wyszukiwania –foo=bar can be used having flags which have a single value and you may are just given after for example –platform= , additionally the setting –foo:pub is utilized getting flags having multiple opinions and certainly will be re-specified several times like –external: .

#Alter API

New change API call operates on a single sequence in the place of supply so you’re able to a document program. This will make it good for include in environment versus a document system (such a web browser) or as an element of some other tool strings. Some tips about what an easy changes ends up:


Current track

Title

Artist