- TypeScript enum recognition and you will inlining
In the event your password makes use of activities that want a number of such types of password optimization to get lightweight, or you are seeking the optimal JavaScript minification formula at your disposal situation, you have to know having fun with other products.
#Outdir
This 1 sets the newest yields list on the make process. Including, this order will create an inventory titled out :
The newest yields directory might possibly be generated whether or not it does not currently occur, it won’t be removed if it currently consists of specific data files. People made data will gently overwrite established data with the exact same title. You should clear the productivity list oneself prior to powering esbuild in the event that need this new output list to simply consist of data regarding the current work at regarding esbuild.
If your make include multiple admission factors from inside the separate listing, this new directory framework was replicated toward production directory creating from the reasonable common predecessor list among all the type in entry point pathways. Particularly, when the there are two entry items src/ home/ index.ts and you may src/ about/ list.ts , the latest production index tend to include family/ directory.js and you will about/ index.js . When you need to modify which choices, you will want to replace the outbase list.
#Outfile
That one kits the fresh yields file name towards create operation. This really is only relevant if there’s one entry point. In the event the there are numerous entry products, you ought to use the outdir option as an alternative to identify a returns list. Having fun with outfile looks like it:
#System
Automatically, esbuild’s bundler try set up to generate password designed for the fresh web browser. In the event the included password is meant to run-in node as an alternative, you should set the working platform to node :
Whenever bundling is actually permitted the newest default productivity structure is decided to help you iife , and this wraps the newest made JavaScript code during the an instantaneously-invoked means phrase to avoid variables regarding leaking to your all over the world extent.
In the event that a deal determine a map towards the web browser career within the the bundle.json file, esbuild use one map to replace certain records otherwise modules the help of its browser-friendly products. Such as, a package might consist of a replacement away from roadway which have path-browserify .
An element of the areas function is determined to web browser, component, chief but with certain additional special choices. If the a great deal aids module and you may fundamental but not internet browser upcoming main is utilized in lieu of component if that package are previously brought in playing with need() . Which decisions improves being compatible that have CommonJS segments one to export a purpose because of the assigning it to module.exports .
New standards setting immediately includes the internet browser position. It changes how the exports field during the bundle.json data try interpreted to prefer browser-specific code.
When using the make API, every process. env. NODE_ENV expressions is actually immediately laid out so you’re able to “production” in the event the all the minification options are enabled and you may “development” or even. Which only goes if the processes , procedure.env , and you can processes.env.NODE_ENV are not currently laid out. It replacing is necessary to avoid Act-dependent password crashing instantly (as procedure was good node API, maybe not an internet API).
Whenever bundling are allowed the standard productivity style is set so you can cjs , hence is short for CommonJS (the brand new module format used by node). ES6-build exports playing with export comments was turned into getters to the the CommonJS exports object.
The centered-from inside the node modules such as for instance fs was automatically http://datingmentor.org/xmeets-review noted while the external so that they usually do not end in errors if the bundler tries to bundle him or her.
Area of the industries means is determined so you’re able to chief, module . It indicates forest moving will not happens having packages one provide both component and fundamental once the forest moving works with ECMAScript modules not with CommonJS segments.