This condition is just active in the event that transfer street try off an enthusiastic ESM transfer declaration or transfer() phrase. It can be used to add ESM-particular password.
This condition is just active if import street was of a great CommonJS wanted() label. It can be utilized to incorporate CommonJS-particular code.
This condition is energetic when esbuild’s platform function is determined so you can web browser . You can use it to add web browser-particular code.
This condition is productive whenever esbuild’s platform means is decided to node . You can use it to incorporate node-particular password.
Note that if you are using new wanted and you may transfer criteria, their bundle could end right up in the bundle many times! This is a subdued material that cause bugs because of duplicate duplicates of code’s state also water retention the fresh ensuing package. This might be commonly known as this new twin package risk. An important technique for to avoid this is exactly to put all of the password regarding require reputation and have the import standing you need to be a light wrapper you to phone calls wanted on your own bundle and you will re-exports the container having fun with ESM sentence structure.
Which informs esbuild to help you change your resource password in advance of building to lose particular constructs. Discover already several it is possible to things that are decrease:
Passing that it banner causes all of the debugger comments to be taken from the latest production. It is much like the drop_debugger: real banner found in standard UglifyJS and Terser JavaScript minifiers.
JavaScript’s debugger comments cause the effective debugger to relieve the fresh new report while the an instantly-designed breakpoint. Code containing which report tend to immediately become paused when the debugger is actually unlock. If the no debugger are unlock, the newest report does absolutely nothing. Dropping these statements from your own code just prevents the newest debugger away from instantly stopping in the event your code runs.
- unit
This will cause such API phone calls are eliminated safely when minification are let
Passageway this banner reasons all of the system API calls as removed throughout the productivity. This can be much like the shed_console: genuine flag in the favorite UglifyJS and you can Terser JavaScript minifiers.
WARNING: Using this type of banner is also expose bugs into the code! That it banner eliminates the entire phone call phrase together with the phone call objections. Or no of them objections got extremely important ill-effects, with this specific flag varies brand new choices of your own password. End up being careful when using that it banner.
Should you want to treat console API phone calls versus deleting the latest objections with side effects (so that you do not expose pests), you need to ple, you can draw unit.diary because the natural having fun with –pure: console.diary .
#Entryway brands
This control this new file labels of one’s efficiency documents relevant to each and every enter in entry point file. They configures the fresh productivity routes using a layout having placeholders that would be substituted having viewpoints certain towards file if output street is established. Eg, specifying an entry term layout of [dir]/ [name]- [hash] comes with a great hash of the output document on file dating Montana term and you will sets the files with the efficiency list, possibly not as much as a subdirectory (comprehend the factual statements about [dir] below). Performing that looks along these lines:
This is the relative path in the list containing the fresh input entry point file on the outbase directory. Their objective should be to make it easier to prevent accidents between identically-called admission items in numerous subdirectories.
Such as for instance, if the there are 2 entryway facts src/ pages/ home/ list.ts and you will src/ pages/ about/ directory.ts , the newest outbase index is actually src , and admission brands theme are [dir]/[name] , brand new productivity list commonly include users/ home/ list.js and profiles/ about/ index.js . If the entry names layout was actually only [name] as an alternative, bundling would have hit a brick wall as there would have been several yields documents with similar production road directory.js inside the returns directory.