
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@babel/standalone
Advanced tools
@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.
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);
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers type-checking and transpilation from TypeScript to JavaScript. Unlike @babel/standalone, TypeScript focuses on adding static types to JavaScript.
Traceur is a JavaScript.next-to-JavaScript-of-today compiler. It allows you to use features from the latest JavaScript standard (ES6 and beyond) and compiles them to ES5. Traceur is similar to @babel/standalone but is less flexible in terms of plugins and presets.
esbuild is an extremely fast JavaScript bundler and minifier. It supports modern JavaScript and TypeScript syntax and can transpile to older versions of JavaScript. Unlike @babel/standalone, esbuild is designed for speed and efficiency in build processes.
Standalone build of Babel for use in non-Node.js environments.
See our website @babel/standalone for more information or the issues associated with this package.
Using npm:
npm install --save-dev @babel/standalone
or using yarn:
yarn add @babel/standalone --dev
v7.22.11 (2023-08-24)
babel-plugin-transform-typescript
babel-types
babel-plugin-transform-async-generator-functions
, babel-plugin-transform-class-static-block
, babel-plugin-transform-dynamic-import
, babel-plugin-transform-export-namespace-from
, babel-plugin-transform-json-strings
, babel-plugin-transform-logical-assignment-operators
, babel-plugin-transform-nullish-coalescing-operator
, babel-plugin-transform-numeric-separator
, babel-plugin-transform-object-rest-spread
, babel-plugin-transform-optional-catch-binding
, babel-plugin-transform-optional-chaining
, babel-plugin-transform-private-property-in-object
babel-core
babel-parser
babel-core
, babel-helper-compilation-targets
, babel-parser
, babel-plugin-proposal-destructuring-private
, babel-plugin-syntax-decorators
, babel-preset-env
, babel-preset-react
, babel-register
, babel-traverse
, babel-types
babel-core
, babel-helpers
, babel-plugin-transform-async-generator-functions
, babel-plugin-transform-modules-commonjs
, babel-plugin-transform-regenerator
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining
, babel-plugin-transform-class-properties
, babel-plugin-transform-classes
, babel-plugin-transform-optional-chaining
, babel-preset-env
?.
output when chain result is ignored (@nicolo-ribaudo)FAQs
Standalone build of Babel for use in non-Node.js environments.
The npm package @babel/standalone receives a total of 1,229,794 weekly downloads. As such, @babel/standalone popularity was classified as popular.
We found that @babel/standalone demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.