Pular para o conteúdo

Which API option lets you indicate the working list to utilize toward generate

Which API option lets you indicate the working list to utilize toward generate

They generally speaking defaults to the present performing listing of the process you are having fun with to-name esbuild’s API. The working index can be used by the esbuild for some additional one thing also resolving cousin paths considering while the API options to natural routes and you will very-print absolute paths once the cousin paths during the record texts. Information on how so you’re able to bypass it:

#JS-specific facts

The newest node-dependent JS API comes in both parallel and you may asynchronous flavors, for every single with assorted tradeoffs. It is important to understand differences to select this new best one for your condition:

#Connect API

  • Avoiding claims may cause machine password
  • Works during the situations that must be parallel like in this need .extensions
  • You simply cannot use plugins on the synchronous API while the plugins is asynchronous
  • They stops the current thread so that you can not would almost every other really works for the time being
  • With the parallel API suppresses esbuild regarding parallelizing esbuild API phone calls

#Async API

  • You are able to plugins into asynchronous API
  • The current bond isn’t banned to help you perform other work in the fresh new interim
  • You might work with of numerous parallel esbuild API phone calls additionally which are following bequeath around the all available CPUs for optimum performance
  • Having fun with guarantees may cause messier code, particularly in CommonJS in which finest-height await isn’t offered
  • Does not work in the situations that must be parallel such in this want .extensions

#Running about browser

This new esbuild API can also run-in the fresh new web browser having fun with WebAssembly during the an internet Employee. When planning on taking advantage of this just be sure to establish the fresh esbuild-wasm plan instead of the esbuild plan:

The API on browser is like brand new API to own node aside from you will want to call initialize() very first, and you need to citation the Website link of your WebAssembly binary. New synchronous brands of one’s API also are unavailable. Assuming you are playing with a good bundler, who would search something such as that it:

If you find yourself already running so it code out of a member of staff and do not want initialize to make various other staff member, you can ticket personnel: incorrect in order to they. This may be can establish an excellent WebAssembly component in identical thread just like the bond you to definitely phone calls initialize .

The API would be reached in another of three straight ways: to the order range, from inside the JavaScript, plus Wade. The new basics and you can variables is mostly identical amongst the around three languages so they really will be presented with her here rather than with independent records for every single words.

There’s two API contacts esbuild’s API: alter and create. It is very important learn which one just be playing with since the it works in different ways.

If you are using JavaScript make sure you take a look at JS-specific details section less than. You may discover TypeScript type significance to possess esbuild useful because a reference. If you use Go make sure to take a look at automatically made Go files.

If you are using the newest demand-range API, it may be useful to know that the fresh flags come in one of three versions: –foo , –foo=club , otherwise –foo:bar . The shape –foo is employed having enabling boolean flags such as for example –minify , best bbw hookup sites the proper execution –foo=bar is employed having flags that have an individual worth and you may are merely given shortly after particularly –platform= , therefore the mode –foo:club is employed getting flags that have multiple values and certainly will feel re also-specified multiple times including –external: .

#Transform API

The fresh new alter API telephone call operates on a single sequence without availability so you’re able to a file program. This will make it ideal for include in surroundings instead a document system (including a web browser) otherwise included in another unit chain. This is what a straightforward changes ends up:

Deixe um comentário

O seu endereço de e-mail não será publicado.