The fresh new minification algorithm from inside the esbuild doesn’t yet , would complex code optimizations

Particularly, next password optimizations try possible for JavaScript code however they are perhaps not accomplished by esbuild (maybe not an exhaustive number):

  • Dead-password removal inside function regulators
  • Mode inlining
  • Cross-declaration ongoing propagation
  • Target shape acting
  • Allowance sinking
  • Strategy devirtualization
  • A symbol delivery
  • JSX expression hoisting
  • TypeScript enum detection and you may inlining

In case the password uses habits which need a number of these forms of password optimization to-be lightweight, or you seek the optimal JavaScript minification formula available instance, you should know playing with most other units. Some examples out of tools one to pertain some of these advanced code https://datingmentor.org/pl/oasis-recenzja/ optimizations are Terser and Yahoo Closure Compiler.

#Outdir

This one set the brand new efficiency index on build operation. Such as, this demand will generate a list named out :

Brand new production list is generated when it cannot currently exist, nevertheless are not removed if this already contains specific records. People produced documents often silently overwrite existing data with the same name. You need to obvious the fresh new production index yourself just before powering esbuild in the event the you want the latest output index to simply contain files on the newest manage away from esbuild.

When your generate consists of several entryway situations for the independent listing, the fresh new list construction might possibly be duplicated for the efficiency index undertaking regarding the reasonable prominent ancestor index certainly one of every type in entry way pathways. Including, if the there are 2 entryway points src/ home/ directory.ts and you may src/ about/ directory.ts , the newest productivity index have a tendency to consist of family/ index.js and on/ index.js . If you want to personalize this behavior, you really need to alter the outbase index.

#Outfile

This one kits the brand new efficiency file term towards the build process. This is just applicable if there’s just one access point. In the event that you can find numerous entry facts, you must use the outdir choice instead to help you identify a yields list. Having fun with outfile looks like it:

#Platform

Automagically, esbuild’s bundler is actually configured to create code intended for the new internet browser. If your included code is intended to run-in node rather, you ought to put the working platform to help you node :

When bundling is let brand new default productivity style is set in order to iife , and this wraps this new produced JavaScript password inside the an immediately-invoked means phrase to cease details from dripping towards the around the globe range.

When the a deal specifies a map to your internet browser job during the the plan.json file, esbuild uses one chart to displace specific data otherwise segments employing browser-friendly types. Particularly, a great deal might have a substitution of street that have street-browserify .

Part of the fields setting is determined so you’re able to web browser, component, fundamental however with certain extra unique behavior. In the event the a deal supports component and you may fundamental not browser then main is employed in lieu of component if it bundle is actually actually ever brought in having fun with wanted() . This choices enhances being compatible with CommonJS modules one export a features by assigning they so you can component.exports .

New requirements form automatically boasts the web browser position. That it transform how exports industry during the package.json data files is translated in order to like browser-certain code.

When using the build API, most of the process. env. NODE_ENV words is actually immediately discussed to help you “production” when the most of the minification options are enabled and you may “development” if you don’t. That it simply goes in the event that procedure , processes.env , and you may techniques.env.NODE_ENV commonly already outlined. This replacing is needed to stop Respond-mainly based password crashing instantaneously (since the processes are a great node API, perhaps not a web API).

When bundling try allowed the fresh new standard output format is determined to help you cjs , and this stands for CommonJS (the newest module format used by node). ES6-style exports playing with export comments might be turned into getters into the the new CommonJS exports object.

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

سوالی دارید؟
مکالمه را شروع کنید
سلام! چگونه می توانیم با پشتیبانی تیم نی نی شینا کمکتون کنیم؟
لطفا برای دریافت پاسخ پشتیبان صبر کنید...