- TypeScript enum identification and inlining
If your password makes use of patterns that need several of these types of forms of password optimisation is lightweight, or you want the optimal JavaScript minification formula at your disposal instance, you need to know playing with almost every other gadgets.
#Outdir
This one establishes the latest returns index into build process. Such as, which order will create an index entitled away :
The production index might be produced whether or not it will not already can be found, it are not cleared if it currently contains particular records. One produced records have a tendency to silently overwrite present files with the exact same title. You should clear brand new efficiency list yourself just before powering esbuild in the event the need the brand new output list to simply incorporate records regarding the latest manage of esbuild.
In case the make consists of several admission points during the separate lists, the newest index structure might be duplicated toward production list doing regarding the low preferred predecessor index certainly one of all of the type in entry way pathways. Instance, if there are two entry issues src/ home/ list.ts and you can src/ about/ list.ts , the fresh new production list often consist of domestic/ directory.js and you can regarding/ directory.js . If you’d like to modify that it behavior, you need to alter the outbase list.
#Outfile
This option set the brand new efficiency file name for the generate process. This is only applicable if there is a single access point. If there are multiple admission products, you ought to use the outdir solution as an alternative so you can establish an efficiency index. Using outfile ends up which:
#Platform
Automagically, esbuild’s bundler are designed to produce code meant for the newest web browser. In case your included password is meant to run-in node instead, you will want to set the platform so you can node :
Whenever bundling was permitted new default yields format is decided to iife , which wraps brand new made JavaScript code within the an instantaneously-invoked form phrase to avoid details off leaking on in the world range.
In the event the a great deal determine a chart towards the internet browser occupation inside the the plan.json document, esbuild use that map to change particular data files or segments the help of its web browser-amicable models. Eg, a great deal you’ll include a substitution from street which have road-browserify .
Part of the industries setting is set in order to browser, module, main however with specific more unique choices. In the event the a package supports component and you can chief although not internet browser after that chief is used unlike component if that plan is ever before imported having fun with want() . Which behavior advances being compatible with CommonJS segments one to export a features by assigning they so you can module.exports .
The latest criteria function instantly boasts the brand new web browser updates. That it change how exports occupation within the plan.json data files are interpreted in order to choose web browser-specific code.
While using the build API, most of the procedure. env. NODE_ENV phrases try instantly outlined so you can “production” if the all the minification options are permitted and you can “development” or even. Which just happens if the techniques , techniques.env , and you may processes.env.NODE_ENV are not already outlined. Which replacement is required to stop Behave-established password crashing quickly (as techniques was an effective node API, maybe not a web site API).
Whenever bundling was allowed new default returns structure is decided to cjs , and this represents CommonJS (this new component style used by node). ES6-concept exports using export comments would-be turned into getters into the brand new CommonJS exports target.
Every created-in node modules instance fs try immediately noted because the additional so they cannot end in mistakes if the bundler attempts to bundle them.
Part of the industries means is decided in order to fundamental, module . This means forest trembling won’t happen getting wing Hoe werkt het werk bundles you to definitely render each other component and you may head given that tree trembling deals with ECMAScript segments however which have CommonJS segments.