Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/standalone

Package Overview
Dependencies
Maintainers
4
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/standalone

Standalone build of Babel for use in non-Node.js environments.

  • 7.22.11
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @babel/standalone?

@babel/standalone is a standalone build of Babel for use in browsers and other non-Node.js environments. It allows you to transpile ES6+ code to ES5 directly in the browser or other environments without needing a build step.

What are @babel/standalone's main functionalities?

Transpile ES6+ to ES5

This feature allows you to transpile modern JavaScript (ES6+) to older versions (ES5) directly in the browser. The code sample demonstrates how to transform an ES6 arrow function to ES5 using the 'env' preset.

const inputCode = 'const arrowFunction = () => {};';
const outputCode = Babel.transform(inputCode, { presets: ['env'] }).code;
console.log(outputCode);

Use Babel plugins

You can use Babel plugins to transform specific JavaScript features. The code sample shows how to transform ES6 classes to ES5 using the 'transform-es2015-classes' plugin.

const inputCode = 'class Example {}';
const outputCode = Babel.transform(inputCode, { plugins: ['transform-es2015-classes'] }).code;
console.log(outputCode);

Custom Babel configurations

You can customize Babel configurations to target specific environments. The code sample demonstrates how to use the 'env' preset with custom browser targets.

const inputCode = 'const x = 1;';
const outputCode = Babel.transform(inputCode, { presets: [['env', { targets: { browsers: ['last 2 versions'] } }]] }).code;
console.log(outputCode);

Other packages similar to @babel/standalone

Keywords

FAQs

Package last updated on 24 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc