- Dead-code reduction within this mode regulators
- Mode inlining
- Cross-declaration ongoing propagation
- Object profile modeling
- Allotment sinking
- Strategy devirtualization
- Emblematic execution
- JSX phrase hoisting
- TypeScript enum recognition and you can inlining
This 1 kits the fresh efficiency index on build operation. Including, which order will generate an index called aside :
The new productivity list could well be made whether or not it will not currently exists, but it are not cleared whether or not it currently consists of certain documents. One produced files commonly quietly overwrite established data files with the exact same label. You should clear brand new output list on your own prior to powering esbuild if you want brand new production index to only incorporate data files regarding most recent run regarding esbuild.
If the make include numerous entry affairs inside the independent listings, new index build would-be replicated into efficiency directory carrying out regarding lowest popular ancestor index certainly one of all the enter in entry way pathways. Such as for example, if the there have been two entryway circumstances src/ home/ index.ts and you will src/ about/ directory.ts , new efficiency index commonly have domestic/ index.js and about/ index.js . If you’d like to tailor so it decisions, you ought to change the outbase directory.
That one kits this new productivity file identity to your build process. This really is just appropriate if you have a single entry way. If the discover several admission items, you must utilize the outdir option alternatively so you can identify a productivity list. Playing with outfile looks like which:
Automagically, esbuild’s bundler was designed to generate code designed for the fresh web browser. If for example the included code is meant to run in node instead, you need to set the working platform in order to node :
When the a deal specifies a chart on the browser community within the the bundle.json file, esbuild will use one to chart to replace specific records or segments employing internet browser-amicable items. Such as Zoosk vs Okcupid for guys for instance, a deal you will consist of a replacement from roadway which have street-browserify .
Area of the industries setting is set so you can internet browser, module, fundamental however with particular most special conclusion. When the a deal supporting component and you may head not web browser up coming chief is utilized rather than component if it plan is actually previously brought in playing with need() . This conclusion enhances compatibility which have CommonJS modules you to export a function by delegating they so you can module.exports .
The brand new standards function instantly comes with new browser condition. This changes the exports profession during the bundle.json data is actually translated so you’re able to choose internet browser-particular code.
When using the generate API, every process. env. NODE_ENV terms try immediately discussed to help you “production” if all of the minification choices are permitted and you can “development” otherwise. This simply goes if techniques , processes.env , and you may process.env.NODE_ENV aren’t already discussed. This replacing is necessary to stop Perform-dependent code crashing immediately (since techniques try a beneficial node API, not a web site API).
Whenever bundling is actually permitted brand new standard production format is determined so you’re able to cjs , hence is short for CommonJS (the fresh module style employed by node). ES6-layout exports having fun with export statements would be changed into getters with the the CommonJS exports target.