- TypeScript enum detection and you will inlining
In case your password makes use of models that require some of these types of different password optimisation are lightweight, or if you are searching for the perfect JavaScript minification algorithm for your use instance, you should consider having fun with most other products.
#Outdir
This one establishes the fresh new productivity directory to your create operation. Like, so it command will create a collection titled out :
This new output directory could well be generated when it will not already are present, nevertheless won’t be cleared in the event it currently contains certain files. One generated records have a tendency to quietly overwrite present files with the same identity. You should obvious the fresh returns index on your own before powering esbuild in the event the you want this new returns index to simply have files throughout the most recent focus on from esbuild.
In case your make includes several admission activities in independent listings, the latest directory build is replicated on the yields directory undertaking regarding the reduced preferred predecessor list certainly one of the enter in entry point routes. Like, in the event the there are 2 entry products src/ home/ directory.ts and you will src/ about/ directory.ts , the returns index often contain family/ index.js and you may on the/ directory.js . If you would like tailor which behavior, you need to change the outbase directory.
#Outfile
This option kits new returns document name with the build procedure. This is certainly simply applicable if there’s one access point. If you can find numerous admission facts, you ought to make use of the outdir alternative alternatively so you’re able to indicate a production directory. Playing with outfile works out which:
#Platform
By default, esbuild’s bundler is set up to generate code designed for the https://datingmentor.org/yemeni-chat-rooms/ brand new internet browser. In the event the included password is meant to run-in node alternatively, you should place the working platform to node :
When bundling was let new standard productivity format is decided so you’re able to iife , which wraps the latest generated JavaScript code inside an immediately-invoked form phrase to eliminate variables out of dripping towards internationally extent.
In the event that a great deal specifies a chart with the web browser community in the the plan.json file, esbuild use one to map to change certain data or segments and their web browser-friendly systems. Such as, a great deal might incorporate a substitution out of highway that have highway-browserify .
Part of the areas means is determined so you’re able to browser, component, head but with specific even more unique choices. If the a deal aids component and you may fundamental however web browser after that head is employed in lieu of module if that bundle is actually actually ever brought in playing with wanted() . It conclusion improves compatibility that have CommonJS segments that export a purpose from the assigning they so you can module.exports .
New requirements means automatically includes the latest internet browser condition. That it alter how exports job during the plan.json files is interpreted to choose web browser-certain code.
While using the create API, all procedure. env. NODE_ENV terms was automatically outlined to “production” if every minification options are permitted and “development” if you don’t. This just goes if the procedure , process.env , and you will process.env.NODE_ENV aren’t currently outlined. This replacement is needed to stop Behave-established password crashing quickly (just like the processes are an excellent node API, maybe not a web API).
When bundling is enabled the new default productivity structure is determined to help you cjs , which is short for CommonJS (the newest module structure employed by node). ES6-style exports using export statements would-be changed into getters to the brand new CommonJS exports target.
All of the built-during the node modules like fs was immediately marked given that exterior so they don’t lead to mistakes if the bundler tries to bundle her or him.
Area of the industries means is set so you’re able to fundamental, component . It means forest moving don’t happens to have bundles you to give both component and you may fundamental once the tree trembling works with ECMAScript segments yet not which have CommonJS modules.
Leave a Reply