
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
babel-standalone
Advanced tools
Standalone build of Babel for use in non-Node.js environments. Similar to the (now deprecated) babel-browser
babel-standalone is a standalone build of Babel for use in non-Node.js environments, including browsers. It's bundled with all the standard Babel plugins and presets, and a build of babili (babel-minify) is optionally available too.
It's true that using Babel through Webpack, Browserify or Gulp should be sufficient for most use cases. However, there are some valid use cases for babel-standalone:
There are several ways to get a copy of babel-standalone. Pick whichever one you like:
bower install babel-standalonenpm install --save babel-standalonebabel.js and/or babel.min.js from the GitHub releases page. Every release includes these files.Load babel.js or babel.min.js in your environment. This will expose Babel's API in a Babel object:
var input = 'const getMessage = () => "Hello World";';
var output = Babel.transform(input, { presets: ['es2015'] }).code;
When loaded in a browser, babel-standalone will automatically compile and execute all script tags with type text/babel or text/jsx:
<div id="output"></div>
<!-- Load Babel -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<!-- Your custom script here -->
<script type="text/babel">
const getMessage = () => "Hello World";
document.getElementById('output').innerHTML = getMessage();
</script>
You can use the data-plugins and data-presets attributes to specify the Babel plugins/presets to use:
<script type="text/babel" data-presets="es2015,stage-2">
Loading external scripts via src attribute is supported too:
<script type="text/babel" src="foo.js"></script>
Note that .babelrc doesn't work in babel-standalone, as no file system access is available. The presets and/or plugins to use must be specified in the options passed to Babel.transform.
Custom plugins and presets can be added using the registerPlugin and registerPreset methods respectively:
// Simple plugin that converts every identifier to "LOL"
function lolizer() {
return {
visitor: {
Identifier(path) {
path.node.name = 'LOL';
}
}
}
}
Babel.registerPlugin('lolizer', lolizer);
Once registered, just use the name of the plugin:
var output = Babel.transform(
'function helloWorld() { alert(hello); }',
{plugins: ['lolizer']}
);
// Returns "function LOL() { LOL(LOL); }"
Custom plugins also work for inline <script>s:
<script type="text/babel" data-plugins="lolizer">
If you want to manually upgrade the Babel version used by babel-standalone (or build your own release), follow these steps:
package.json. This can be done with npm-check-upgrades (eg. npm-check-updates -u -a --packageFile ./package.json /^babel\-/)node_modules, as npm often produces inefficient directory layouts if you upgrade in-placenpm install && npm run buildnpm run test to ensure it worksexamples/example.htm and ensure it worksFAQs
Standalone build of Babel for use in non-Node.js environments. Similar to the (now deprecated) babel-browser
The npm package babel-standalone receives a total of 25,777 weekly downloads. As such, babel-standalone popularity was classified as popular.
We found that babel-standalone demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.