Thông tin sản phẩm
They generally speaking non-payments to the current functioning directory of the procedure you are having fun with to call esbuild’s API. The working directory is used from the esbuild for some more one thing also fixing cousin paths given as the API choices to sheer paths and you can quite-print sheer routes due to the fact relative pathways when you look at the log texts. Here is how to override it:
#JS-specific information
New node-situated JS API comes in both synchronous and asynchronous variants, per with various tradeoffs. You will need to be aware of the distinctions to choose the correct one for the situation:
#Sync API
- To avoid guarantees can cause machine code
- Really works during the products that really must be synchronous like inside need .extensions
- You cannot play with plugins on parallel API just like the plugins is actually asynchronous
- It prevents the modern thread you are unable to create most other really works meanwhile
- Making use of the synchronous API prevents esbuild off parallelizing esbuild API calls
#Async API
- You can utilize plugins into asynchronous API
- The current thread is not prohibited to help you create most other work in the new meantime
- You could run of a lot multiple esbuild API phone calls while doing so that are then pass on round the all the available CPUs for optimum overall performance
- Using claims can lead to messier code, especially in CommonJS in which most readily useful-height loose time waiting for isn’t available
- Does not work in the situations that have to be synchronous such as randki we wiet namie for instance in this need .extensions
#Running from the web browser
The newest esbuild API also can run in the newest web browser having fun with WebAssembly when you look at the a web site Staff. To take advantage of so it you will need to arranged the brand new esbuild-wasm bundle instead of the esbuild package:
The API to the browser is like the latest API to possess node apart from you will want to name initialize() very first, and you need to pass the new Url of your WebAssembly digital. The fresh synchronous sizes of API are also unavailable. And if you are using an effective bundler, that would look something like this:
When you find yourself already powering that it password from an employee and don’t need initialize in order to make several other staff member, you might citation employee: untrue to it. Then it will create a WebAssembly component in identical thread since thread that phone calls initialize .
The fresh API would be reached in just one of three ways: with the order line, into the JavaScript, and in Go. Brand new rules and you will variables is mainly similar amongst the around three dialects so they will be presented along with her here in the place of which have separate papers each words.
There’s two API calls in esbuild’s API: transform and construct. You will need to understand which one you need to be playing with as it works in another way.
If you are using JavaScript make sure to investigate JS-certain details section less than. You can even select the TypeScript style of significance to have esbuild helpful because a research. If you utilize Go make sure to take a look at the immediately generated Wade documentation.
When you use this new order-line API, it could be beneficial to be aware that this new flags come into certainly about three versions: –foo , –foo=bar , otherwise –foo:bar . The form –foo is employed to have helping boolean flags such as for instance –minify , the shape –foo=pub can be used to possess flags having an individual really worth and are merely given shortly after such –platform= , in addition to form –foo:pub is used to own flags with numerous values and can feel re-specified many times for example –external: .
#Alter API
New alter API call operates using one string without access so you’re able to a document system. This will make it best for include in environment versus a file system (such a browser) otherwise as part of several other tool strings. Here’s what a simple change ends up: