It’s designed to been history and you may enables you to promote an excellent fallback getting when hardly any other standing enforce

It’s designed to been history and you may enables you to promote an excellent fallback getting when hardly any other standing enforce

Code who has which statement will instantly getting paused if debugger is unlock

This condition is only effective if the import road is away from an enthusiastic ESM transfer declaration or transfer() expression. You can use it to add ESM-specific password.

This condition is only active when the import street was from a CommonJS wanted() phone call. You can use it to provide CommonJS-certain password.

This disorder is just energetic whenever esbuild’s program form is determined so you’re able to web browser . It can be used to provide browser-particular code.

This condition is productive whenever esbuild’s platform setting is set in order to node . You can use it to include node-particular password.

Keep in mind that when you use the brand new wanted and transfer requirements, your plan might end up regarding the plan several times! This will be a refined situation that cause bugs on account of duplicate copies of your code’s condition plus water retention the latest resulting bundle. This might be commonly known as the newest twin package possibilities. The key way of to avoid this really is to put each one of your own password throughout the need condition and also have the transfer standing you need to be a white wrapper you to calls need on the plan and you will lso are-exports the package using ESM sentence structure.

That it informs esbuild so you’re able to edit their source code ahead of building to help you get rid of specific constructs. Discover currently a couple you are able to items that is going to be fell:

Passage this banner reasons most of the debugger statements to-be taken off the newest productivity. This is just like the miss_debugger: genuine banner found in standard UglifyJS and you can Terser JavaScript minifiers.

JavaScript’s debugger comments cause the energetic debugger to relieve brand new declaration just like the an automatically-configured breakpoint. In the event the no debugger was open, the brand new declaration does absolutely nothing. Dropping these statements from the password only prevents the fresh debugger off automatically finishing in the event the code operates.

  • unit

Passage that it banner explanations every unit API phone calls to be removed regarding the productivity. This is exactly much like the miss_console: genuine banner for sale in the popular UglifyJS and you can Terser JavaScript minifiers.

WARNING: With this particular flag can also be expose pests into the code! This flag eliminates the whole label expression and additionally all label arguments. Or no ones objections got important ill-effects, with this banner will vary the brand new behavior of password. End up being very careful while using the so it flag

If you’d like to dump console API calls in place of deleting the brand new arguments with side effects (so that you don’t expose bugs), you ought to ple, you could mark console.record due to the fact natural using –pure: console.record . This may lead to this type of API phone calls becoming removed safely when minification is let.

#Entry labels

That one regulation brand new document brands of your yields data associated to each and every type in access point file. It configures the productivity pathways using a layout with placeholders one might possibly be substituted which have philosophy specific into the file when the production street is made. Such, indicating an entry title template from [dir]/ [name]- [hash] comes with an excellent hash of one’s yields document on the document name and you may places the fresh data into productivity list, possibly lower than a beneficial subdirectory (understand the information regarding [dir] below). Performing that looks in this way:

This is the relative street on the index with the fresh enter in entry way document to your outbase directory. Their objective will be to make it easier to end crashes between identically-entitled entry issues in different subdirectories.

Eg, in the event the there have been two admission situations src/ pages/ home/ directory.ts and src/ pages/ about/ list.ts , the outbase directory are src , and the entry brands layout was [dir]/[name] , new output directory usually incorporate profiles/ home/ list.js and pages/ about/ list.js . When your entryway labels layout had been simply [name] instead, bundling could have hit a brick wall since there could have been a couple of yields documents with the same efficiency street directory.js from inside the output directory.


Bình luận