This problem is only active when the transfer path is out-of a keen ESM transfer declaration or transfer() expression. It can be utilized to provide ESM-certain password.
This disorder is just productive if transfer roadway was from an excellent CommonJS require() name. You can use it to provide CommonJS-specific code.
This condition is only productive whenever esbuild’s system means is set in order to browser . You can use it to add browser-particular code.
This problem is energetic when esbuild’s program means is set to node . It can be utilized to add node-specific code.
Observe that by using the fresh want and transfer standards, the bundle might end up in the plan several times! This will be a subtle question that cause insects because of duplicate copies of code’s state as well as water retention the brand new resulting plan. This is exactly often called the fresh new dual package threat. An important technique for avoiding this will be to put each one of your password about require position and have the import status you should be a light wrapper one calls need in your plan and you can re also-exports the box using ESM syntax.
It informs esbuild so you’re able to edit the resource code in advance of strengthening so you’re able to shed specific constructs. You can find already two you’ll be able to points that can be dropped:
Passageway that it flag factors every debugger comments to-be taken off the new production. This might be much like the shed_debugger: true banner obtainable in the favorite UglifyJS and you can Terser JavaScript minifiers.
JavaScript’s debugger comments result in the productive debugger to treat the brand new statement once the an automatically-designed breakpoint. Password that has that it declaration tend to immediately become paused if the debugger are unlock. When the no debugger try open, the fresh declaration really does little. Shedding this type of statements from your own code only inhibits the new debugger off automatically finishing whether your code runs.
- system
This will end up in such API calls to be got rid of safely when minification is enabled
Passage that it flag factors the system API calls are removed on the efficiency. This is certainly just like the miss_console: true flag in the popular UglifyJS and you will Terser JavaScript minifiers.
WARNING: Using this banner is introduce pests into the code! That it flag takes away the complete name term also every telephone call arguments. Or no ones objections got crucial ill effects, using this type of flag will change the fresh new conclusion of code. Getting cautious while using which banner.
If you want to dump unit API phone calls in the place of removing the newest arguments which have ill-effects (which means you don’t establish bugs), you will want to ple, you can mark console.record as pure having fun with –pure: system.record .
#Entry names
This 1 control this new document labels of one’s efficiency data corresponding to each input entry point document. They configures the fresh new efficiency routes having fun with a theme having placeholders that is replaced which have thinking certain towards document when the production road is generated. Such as for instance, indicating an entry name template regarding [dir]/ [name]- [hash] boasts an excellent hash of your efficiency file from the file name and you will puts the newest records toward efficiency index, potentially lower than a subdirectory (see the information about [dir] below). Performing that looks in this way:
This is actually http://www.datingmentor.org/xmatch-review/ the relative path about directory with the new input entry point file towards the outbase index. Its purpose should be to make it easier to stop accidents anywhere between identically-called entry situations in numerous subdirectories.
Such as for instance, in the event that there have been two admission products src/ pages/ home/ index.ts and you may src/ pages/ about/ directory.ts , the latest outbase index try src , additionally the entry names theme try [dir]/[name] , new output list will consist of pages/ home/ index.js and you can profiles/ about/ list.js . Should your entry brands template is merely [name] rather, bundling might have hit a brick wall as there could have been a couple of output documents with similar productivity path directory.js into the productivity index.