It is meant to been past and you may lets you bring an effective fallback for whenever not any other condition applies
This disorder is only productive in the event that import roadway is actually out of an ESM import statement otherwise import()
This problem is just productive in the event the import highway are regarding an effective CommonJS need() telephone call. It can be utilized to add CommonJS-certain password.
This condition is only effective when esbuild’s program means is decided so you can browser . It can be used to include internet browser-particular code.
This condition is only energetic when esbuild’s platform mode is decided to help you node . You can use it to incorporate node-certain password.
Observe that if you use the newest need and you will transfer standards, your plan could end right up about bundle several times! This is a slight question that cause bugs because of duplicate copies of your own code’s state together with bloating brand new ensuing plan. This is exactly often called the fresh dual bundle possibility. The primary way of avoiding this will be to place all of your own code regarding the need reputation and also have the transfer status you should be a white wrapper you to definitely phone calls need on the package and you will re also-exports the package having fun with ESM syntax.
This tells esbuild so you’re able to edit your own supply code in advance of strengthening so you’re able to shed particular constructs. You’ll find currently several you’ll be able to items that should be dropped:
Passage it flag factors most of the debugger statements to get taken from the production. This might be much like the miss_debugger: true flag obtainable in the popular UglifyJS and Terser JavaScript minifiers.
JavaScript’s debugger statements result in the active debugger to ease new declaration given that an instantly-set up breakpoint. Code who has this report will automatically getting paused if debugger are open. In the event that no debugger are open, new report does little. Losing such statements from your password only suppress the brand new debugger from immediately closing in the event your password operates.
- console
This may result in such API calls to get got rid of securely whenever minification try enabled
Passing it banner causes all the system API phone calls become eliminated on output. This can be just as the miss_console: true flag in standard UglifyJS and you can Terser JavaScript minifiers.
WARNING: With this flag can also be present bugs into your code! Which banner eliminates the complete phone call expression and additionally the phone call arguments. Or no ones objections had important ill effects, using this banner varies the newest choices of your own code. Become very careful when using which flag.
Should you want to lose unit API calls as opposed to deleting the arguments that have harmful effects (you don’t establish bugs), you should ple, you can mark console.record given that absolute using —pure: unit.log .
#Entryway labels
That one controls brand new document labels of your own yields documents relevant every single input access point file. They configures the fresh returns paths using a theme with placeholders one might possibly be replaced with beliefs certain on document if yields path is created. Such as, specifying an admission title layout from [dir]/ [name]- [hash] includes good hash of one’s productivity file in the document name and places the fresh new data files toward productivity index, probably lower than a good subdirectory (see the information regarding [dir] below). Creating that looks along these lines:
This is basically the relative roadway regarding list containing new type in access point file towards the outbase index. The objective will be to help you end accidents ranging from identically-named entryway facts in almost any subdirectories.
Eg, in the event the there’s two entry points src/ pages/ home/ index.ts and you may src/ pages/ about/ list.ts , the fresh outbase directory was src , and entry brands theme is [dir]/[name] , new efficiency directory will include pages/ home/ index.js and you will users/ about/ list.js . In case your admission brands layout ended up being merely [name] alternatively, bundling will have were unsuccessful as there might have been two production files with the exact same production street list.js when you look at the returns list.