Which API option enables you to indicate the functional directory to make use of on build

It generally speaking defaults to the present working set of the method you https://datingmentor.org/pl/oasis-dating-recenzja/ are using to call esbuild’s API. The functional index is used of the esbuild for a few more one thing and resolving relative paths considering once the API options to absolute pathways and you will fairly-printing sheer routes due to the fact cousin routes from inside the record messages. Information on how so you can override it:

#JS-certain info

The fresh node-oriented JS API comes in both parallel and you may asynchronous types, for each and every with assorted tradeoffs. You should understand the distinctions to pick the new best one for your situation:

#Sync API

  • To avoid guarantees can lead to machine password
  • Performs within the issues that have to be synchronous for example in this wanted .extensions
  • You can not have fun with plugins to the synchronous API because plugins is asynchronous
  • They prevents the present day thread you cannot perform other works for the time being
  • Making use of the parallel API suppresses esbuild regarding parallelizing esbuild API calls

#Async API

  • You are able to plugins towards asynchronous API
  • The current bond is not blocked in order to do almost every other operate in the newest meantime
  • You could potentially work with of several simultaneous esbuild API calls in addition which are up coming give around the the readily available CPUs for maximum show
  • Playing with promises can cause messier password, particularly in CommonJS where better-top expect is not available
  • Can not work into the things that must definitely be parallel such as for instance within this need .extensions

#Running regarding internet browser

The latest esbuild API may also run in the latest internet browser playing with WebAssembly inside an internet Employee. When deciding to take benefit of this you will need to set-up the fresh new esbuild-wasm bundle as opposed to the esbuild package:

The fresh API to the internet browser is similar to brand new API to own node aside from you should phone call initialize() basic, and you ought to pass this new Hyperlink of one’s WebAssembly binary. The latest parallel sizes of one’s API are also not available. Just in case you’re using an excellent bundler, who does browse something like which:

When you find yourself already running that it password of an employee plus don’t want initialize which will make various other staff, you might citation employee: not true to it. It can establish a beneficial WebAssembly module in identical thread due to the fact thread one phone calls initialize .

The API are accessed in just one of three straight ways: into command line, inside JavaScript, along with Go. New principles and you may details was mostly similar between the three languages so that they will be provided with her here in lieu of with independent paperwork for every words.

There are 2 API contacts esbuild’s API: transform and build. It’s important to discover what type you should be playing with since the it works in different ways.

When you use JavaScript make sure to take a look at the JS-particular information section below. You may want to discover TypeScript type of meanings to own esbuild helpful as a reference. When you use Wade definitely look at the automatically made Wade papers.

By using the latest demand-line API, it may be beneficial to be aware that brand new flags come in one of three versions: –foo , –foo=pub , or –foo:club . The form –foo is used for permitting boolean flags such as for example –minify , the form –foo=club is used getting flags that have one worth and you may are only given immediately following particularly –platform= , additionally the form –foo:pub is employed to have flags having several beliefs and can be lso are-specified several times like –external: .

#Alter API

The fresh transform API label operates using one sequence instead of accessibility to a file system. This makes it best for use in environment versus a document system (including a web browser) or included in other device strings. This is what an easy alter looks like:

admin
Author: admin