babel-solo0.0.1 • Public • Published
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.
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:
- Integration of Babel into a non-Node.js environment (ReactJS.NET, ruby-babel-transpiler, php-babel-transpiler, etc).
There are several ways to get a copy of babel-standalone. Pick whichever one you like:
- Use it via CDNJS: https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.10.3/babel.min.js. This is a simple way to embed it on a webpage without having to do any other setup.
- Install via Bower:
bower install babel-standalone
- Install via NPM:
npm install --save babel-standalone
- Manually grab
babel.min.jsfrom the GitHub releases page. Every release includes these files.
babel.min.js in your environment. This will expose Babel's API in a
var input = 'const getMessage = () => "Hello World";';var output = Babelcode;
When loaded in a browser, babel-standalone will automatically compile and execute all script tags with
<!-- Load Babel --><!-- Your custom script here -->
.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