{"id":40534,"library":"6-to-library","title":"6-to-library","description":"A deprecated formatter plugin for 6to5 (predecessor to Babel) that transforms ES6 modules into CommonJS, AMD, or global scripts for library distribution. Version 0.3.4 was the last release. It was made obsolete by 6to5 v2.7.0+, which added native module export support. Key differentiator: allowed library authors to write in ES6 and target multiple module systems seamlessly by specifying '6-to-library' as the modules option in 6to5.","status":"deprecated","version":"0.3.4","language":"javascript","source_language":"en","source_url":"https://github.com/tomekwi/6-to-library.js","tags":["javascript","6to5","es6","harmony","umd","amd","commonjs","global","globals"],"install":[{"cmd":"npm install 6-to-library","lang":"bash","label":"npm"},{"cmd":"yarn add 6-to-library","lang":"bash","label":"yarn"},{"cmd":"pnpm add 6-to-library","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a plugin for 6to5, not a standalone import. It is used by passing its name as the modules option.","symbol":"6-to-library formatter","correct":"// In 6to5 config: modules: '6-to-library'"},{"note":"The formatter expects a default export to generate a simple UMD module. Named exports remain accessible via .default and .exportName.","symbol":"Default export in library code","correct":"export default function myFunc() {}"},{"note":"If library only has a default export, the generated CommonJS wrapper exports the default directly, so no .default needed.","wrong":"var lib = require('your-library').default;","symbol":"Resulting CommonJS require","correct":"var lib = require('your-library');"}],"quickstart":{"code":"// Install 6to5 and 6-to-library\nnpm install --save 6to5 6-to-library\n\n// Write your library in ES6 (e.g., es6/up-first-letter.js)\n// es6/up-first-letter.js:\nexport default function (string) {\n  return string.charAt(0).toLocaleUpperCase() + string.substr(1);\n}\n\n// Transpile using 6to5 CLI\n6to5 --modules 6-to-library --out-file index.js es6/up-first-letter.js\n\n// Then publish index.js as your library entry point\n// Users can consume it with:\nvar upFirstLetter = require('up-first-letter');\nupFirstLetter('hello'); // 'Hello'","lang":"javascript","description":"Demonstrates how to use 6-to-library formatter to transpile an ES6 module with a default export into a distributable UMD file."},"warnings":[{"fix":"Upgrade to a newer version of Babel (formerly 6to5) and use its built-in module formatting (e.g., modules: 'umd' or 'commonjs').","message":"This package is deprecated. 6to5 (now Babel) added built-in UMD export support in version 2.7.0, making this formatter unnecessary.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure your library exports a single default if you want seamless CommonJS usage; otherwise, users must access named exports via .default and .exportName.","message":"If library has only a default export, the generated CommonJS wrapper does NOT use .default; require() returns the default directly. Named exports require accessing .exportName.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use unique file names or manually specify global names in 6to5 configuration if available.","message":"Global object names are derived from file basenames (camel-cased). This may cause conflicts if multiple files have similar names.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.3.4':28 '6':1,63 '6to5':10,38,72,74 'ad':41 'allow':48 'amd':20,78 'author':50 'babel':13 'commonj':19,79 'deprec':6 'differenti':47 'distribut':26 'es6':16,54,75 'export':44 'formatt':7 'global':22,80,81 'harmoni':76 'javascript':73 'key':46 'last':31 'librari':4,25,49,66 'made':35 'modul':17,43,58,69 'multipl':57 'nativ':42 'obsolet':36 'option':70 'plugin':8 'predecessor':11 'releas':32 'script':23 'seamless':60 'specifi':62 'support':45 'system':59 'target':56 'to-librari':2,64 'transform':15 'umd':77 'v2.7.0':39 'version':27 'write':52","created_at":"2026-06-04T18:48:02.417799+00:00","updated_at":"2026-06-04T18:48:02.417799+00:00","problems":[{"fix":"Run 'npm install --save 6-to-library' and ensure node_modules includes it.","cause":"The 6-to-library package is not installed, or 6to5 cannot locate it.","error":"Error: Cannot find module '6-to-library'"},{"fix":"Change 'var lib = require('...').default' to 'var lib = require('...')'.","cause":"Library only has a default export; the generated CommonJS wrapper exports the default directly, so .default is not needed.","error":"require('...').default is undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/tomekwi/6-to-library.js","github":"https://github.com/tomekwi/6-to-library.js","docs":null,"changelog":null,"pypi":null,"npm":"6-to-library","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}