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:
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:
- 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
- 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 .
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 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 , 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: .
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: