babel-standalone provides a standalone build of Babel (v6.26.0) for use in non-Node.js environments, primarily browsers. It bundles all standard Babel plugins and presets, including an optional babili (babel-minify) build. Unlike the Babel CLI or module-based usage, this package requires no build step — it exposes a global Babel object and can automatically transpile script tags with type="text/babel" or "text/jsx". It is ideal for REPLs, JSFiddle-like sites, or embedding JavaScript scripting in apps. Note that this is based on Babel 6; Babel 7+ has its own @babel/standalone package with a different API.
npm install babel-standaloneVerified import paths — ran on the pinned version, not inferred.
Loads babel-standalone from CDN and uses inline script tag with type text/babel to automatically transpile ES2015 arrow function.
Switch to @babel/standalone. Update script source to https://unpkg.com/@babel/standalone/babel.min.js and adjust API usage (e.g., Babel.transform -> Babel.transformSync).
Ensure code inside script tags handles asynchronous execution if needed, or switch to explicit Babel.transformSync.
Specify presets in the script tag: <script type="text/babel" data-presets="es2015"> or in Babel.transform({presets: ['es2015']}).Upgrade to v6.24.0+ or use inline scripts only.
Load babel-standalone script before any script that references Babel. Ensure the URL is correct: <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
Verify the CDN URL or download the file and host locally. Use a reliable CDN like unpkg or cdnjs.
Pass preset in options: Babel.transform(input, { presets: ['es2015'] }) or use data-presets="es2015" in script tags.No dependency data recorded yet.