Sucrase rivals Babel JavaScript compiler for development use

try {
threshold : 0, // You can set threshold on how close to the edge ad should come before it is loaded. Default is 0 (when it is visible).
forceLoad : false, // Ad is loaded even if not visible. Default is false.
onLoad : false, // Callback function on call ad loading
onComplete : false, // Callback function when load is loaded
timeout : 1500, // Timeout ad load
debug : false, // For debug use : draw colors border depends on load status
xray : false // For debug use : display a complete page view with ad placements
}) ;
catch (exception){
console.log(“error loading lazyload_ad ” + exception);

The speedy Sucrase compiler is emerging as a potential alternative to the  for development purposes, if not for production builds. The developers behind the project claim that , while acknowledging that it lacks Babel’s scope and versatility. 

Sucrase is intended to make programming more fun by making builds faster. Sucrase assumes a developer is using a recent browser or a recent version of Node.js. Thus, it focuses on compiling non-standard language extensions such as TypeScript, Flow, and JSX. This narrower scope enables leveraging of a compiler architecture that is much more performant, albeit less extensible and maintainable. As a result, developers are advised to think carefully about using Sucrase in production. Babel or tsc is more suitable for production builds in most cases. 

The Sucrase parser is a trimmed-down fork of the Babel parser that focuses on a subset of what is addressed by Babel. The main configuration option in Sucrase is an array of transform names including jsx, typescript, flow, and react-hot-loader. Some JavaScript syntax such as decorators and private fields are not supported by Sucrase but passed through, so must be supported by the developer’s JavaScript runtime.

The creators of Sucrase also cite these limitations:

  • Sucrase does not check code for errors and should always be used with a linter or typechecker.
  • Sucrase does not leverage plug-ins. Transforms need to be written to cooperate with each other; each additional transform takes significant work. 
  • The tool is not good for prototyping language extensions and upcoming language features. The faster architecture of Sucrase makes new transforms more fragile and more difficult to write.

You can  via yarn or npm. Installation instructions and documentation are provided in the .