This problem is just energetic when the import highway is actually from an ESM transfer statement or transfer() phrase. It can be utilized to add ESM-particular password.
This disorder is only active in the event that transfer path try out-of a good CommonJS require() label. You can use it to add CommonJS-specific password.
This disorder is only productive whenever esbuild’s program form is determined so you can browser . You can use it to add internet browser-specific code.
This condition is effective when esbuild’s platform setting is set so you’re able to node . You can use it to add node-specific code.
Observe that https://datingmentor.org/local-hookup/new-orleans/ when you use new want and you will transfer conditions, your own package may end right up regarding the plan several times! This is exactly a discreet matter that cause pests due to backup copies of code’s county and additionally water retention brand new ensuing bundle. This might be often called this new dual bundle danger. The key technique for to avoid this is to place every one of their code throughout the require condition and also have the transfer standing you should be a light wrapper you to definitely calls require in your package and you may lso are-exports the package having fun with ESM syntax.
This says to esbuild so you can revise your own provider password prior to building to help you shed particular constructs. There are already one or two you are able to things that might be decrease:
Passageway that it flag grounds all the debugger statements becoming removed from the fresh productivity. This might be much like the lose_debugger: genuine banner available in standard UglifyJS and you may Terser JavaScript minifiers.
JavaScript’s debugger comments cause the productive debugger to relieve this new report since the an automatically-set up breakpoint. Password that has so it statement usually instantly be paused in the event that debugger try discover. If the no debugger are unlock, new statement does nothing. Shedding these types of comments from your password only prevents the fresh debugger out-of immediately closing in the event your password operates.
- unit
This will produce such API phone calls to be eliminated properly whenever minification was permitted
Passage this banner reasons all of the unit API calls become eliminated on yields. That is just like the drop_console: genuine banner available in the favorite UglifyJS and you will Terser JavaScript minifiers.
WARNING: Using this flag can also be expose bugs into the password! Which flag takes away the whole phone call expression and additionally every call objections. Or no of these arguments had very important side effects, with this specific banner may differ the brand new conclusion of one’s password. Become careful when using which flag.
If you wish to clean out console API calls versus deleting the new arguments which have ill effects (you don’t present pests), you ought to ple, you could potentially draw unit.record while the natural playing with –pure: system.journal .
#Entryway names
This package regulation the brand new document names of one’s returns documents involved to each enter in access point document. They configures brand new efficiency pathways using a theme having placeholders one will be replaced which have opinions particular for the file if the efficiency street is generated. Eg, specifying an entrance identity layout out-of [dir]/ [name]- [hash] is sold with a good hash of one’s returns document regarding document name and you can places the newest files towards production directory, possibly below a subdirectory (comprehend the factual statements about [dir] below). Creating that appears like this:
Here is the cousin path regarding index that features the fresh enter in access point file with the outbase index. Its goal is to try to make it easier to stop accidents ranging from identically-entitled admission items in almost any subdirectories.
Such as for instance, in the event that there are two entryway circumstances src/ pages/ home/ directory.ts and src/ pages/ about/ index.ts , the brand new outbase list was src , therefore the entryway brands template try [dir]/[name] , the fresh new yields index will have pages/ home/ list.js and you will pages/ about/ directory.js . If the admission labels template is merely [name] alternatively, bundling might have hit a brick wall because there would-have-been two output files with similar output street list.js inside returns list.