{"id":25632,"library":"glia-babel-standalone","title":"babel-standalone","description":"babel-standalone provides a standalone, browser-ready build of Babel (v6.26.0) with all standard plugins and presets bundled, enabling ES2015+ transpilation in non-Node.js environments like browsers, REPLs, and embedded JavaScript engines. It is a maintained fork of the deprecated babel-browser package, offering similar functionality with automated updates to align with Babel releases. Key differentiators include automatic compilation of <script type='text/babel'> tags, support for custom plugins/presets, and optional integration with babili-minify. It does not support .babelrc due to lack of file system access, and is not a replacement for build-tool integration in Node-based workflows.","status":"active","version":"6.26.0","language":"javascript","source_language":"en","source_url":"https://github.com/Daniel15/babel-standalone","tags":["javascript","babel","babeljs","6to5","transpile","transpiler"],"install":[{"cmd":"npm install glia-babel-standalone","lang":"bash","label":"npm"},{"cmd":"yarn add glia-babel-standalone","lang":"bash","label":"yarn"},{"cmd":"pnpm add glia-babel-standalone","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default import works in Node when using ESM; in browsers, use the global `Babel` object via script tag.","wrong":"const Babel = require('babel-standalone');","symbol":"Babel","correct":"import Babel from 'babel-standalone'"},{"note":"This method is synchronous in standalone; no callback version exists.","wrong":"Babel.transform(code, opts, callback)","symbol":"Babel.transform","correct":"Babel.transform(code, options)"},{"note":"Method is directly on the Babel global, not nested.","wrong":"Babel.plugins.register('name', pluginFunction)","symbol":"Babel.registerPlugin","correct":"Babel.registerPlugin('name', pluginFunction)"}],"quickstart":{"code":"// browser: HTML with script tags\n// Load standalone Babel from CDN\n// <script src=\"https://unpkg.com/babel-standalone@6/babel.min.js\"></script>\n\n// Inline script using text/babel type\n// <script type=\"text/babel\">\nconst code = 'const square = n => n * n;';\nconst result = Babel.transform(code, { presets: ['es2015'] });\nconsole.log(result.code); // ES5 output\n// </script>","lang":"javascript","description":"Shows in-browser usage: load babel-standalone via unpkg, then transform ES6 arrow function with es2015 preset."},"warnings":[{"fix":"Upgrade to v6 and use Babel.transform instead of older babel-browser API.","message":"babel-standalone v7 is not released; v6 is the latest stable. Migration path from babel-browser is breaking due to API changes (no more Babel global in some contexts).","severity":"breaking","affected_versions":"<=5"},{"fix":"Always specify presets/plugins explicitly in options or data attributes.","message":".babelrc is not supported because no file system is available. All configuration must be passed programmatically or via data-presets/data-plugins attributes.","severity":"gotcha","affected_versions":">=6"},{"fix":"Ensure your script tags use the correct type attribute.","message":"Automatic script tag compilation only works for <script type='text/babel'> or <script type='text/jsx'>. Other types (e.g., 'text/ecmascript-6') are ignored.","severity":"gotcha","affected_versions":">=6"},{"fix":"Use presets: ['env'] instead of presets: ['es2015'].","message":"The 'es2015' preset is deprecated in favor of 'env'. Future versions may remove it.","severity":"deprecated","affected_versions":">=6"},{"fix":"Stick to 6.x for production use.","message":"Babel version is pinned to 6.26.0; alpha releases of v7 are available but not stable. Do not use v7 alpha in production.","severity":"gotcha","affected_versions":">=7.0.0-alpha"},{"fix":"Use @babel/core in Node environments.","message":"When using npm package in Node.js, it is not optimized for Node and may contain browser-specific polyfills. Use @babel/core for Node projects.","severity":"gotcha","affected_versions":">=6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the <script src='https://unpkg.com/babel-standalone@6/babel.min.js'> tag appears before any script that references Babel.","cause":"babel.min.js script not loaded before using Babel in inline script.","error":"Uncaught ReferenceError: Babel is not defined"},{"fix":"Use a CDN script tag for browsers, or configure Webpack to resolve browser field. Not recommended for bundling.","cause":"Attempting to import babel-standalone in a bundler without proper configuration.","error":"Error: Module not found: Can't resolve 'babel-standalone'"},{"fix":"Use Babel.registerPreset('env', ...) to register a custom preset or use a bundled preset like 'es2015'.","cause":"Trying to use 'env' preset but no preset registered; standalone only includes 'es2015', 'react', 'stage-0' etc., not @babel/preset-env.","error":"Cannot find preset 'env' relative to directory"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}