{"id":19387,"library":"brfs-babel","title":"brfs-babel","description":"A browserify transform that inlines static file contents at build time, similar to brfs but built on top of Babel for ES2015+ support. Version 2.0.0 is the current stable release. It handles ES2015 import syntax, supports fs.readFileSync and fs.readdirSync, and evaluates path.join/path.resolve statically. Unlike brfs, it works with Babel AST for cleaner output and source maps, but is experimental and has limitations (e.g., no support for dynamic expressions or inline CommonJS require).","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/Jam3/brfs-babel","tags":["javascript","babel","brfs","es2015","commonjs","es6","babelify","browserify","bundle"],"install":[{"cmd":"npm install brfs-babel","lang":"bash","label":"npm"},{"cmd":"yarn add brfs-babel","lang":"bash","label":"yarn"},{"cmd":"pnpm add brfs-babel","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Babel AST manipulation for transform","package":"@babel/core","optional":false},{"reason":"Used internally for static evaluation of file reads","package":"static-module","optional":false}],"imports":[],"quickstart":{"code":"// Install: npm install brfs-babel\n// In your browserify build command:\n// browserify index.js -t brfs-babel\n\n// Example file: index.js\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\nconst src = readFileSync(join(__dirname, 'hello.txt'), 'utf8');\nconsole.log(src);\n\n// With hello.txt containing \"Hello, World!\", after transform:\n// import { join } from 'path';\n// const src = 'Hello, World!';\n// console.log(src);","lang":"javascript","description":"Shows basic usage of brfs-babel with browserify and ES2015 import syntax."},"warnings":[{"fix":"Use brfs for more fs methods or implement custom transform.","message":"Only fs.readFileSync and fs.readdirSync are supported, not fs.writeFileSync or fs.statSync.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use only static string paths with path.join or path.resolve.","message":"Dynamic expressions (e.g., __dirname + variable) are not evaluated statically, causing runtime errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use ES2015 import syntax for fs.","message":"Inline CommonJS require('fs').readFileSync is not supported; only imported fs works.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using brfs or browserify-plugin-fs for production.","message":"Package is experimental and no longer actively maintained. brfs is more stable and widely used.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev brfs-babel` in project directory.","cause":"brfs-babel not installed globally or locally.","error":"Error: Cannot find module 'brfs-babel'"},{"fix":"Use static path like path.join(__dirname, 'file.txt').","cause":"Dynamic variable used in file path that brfs-babel cannot evaluate.","error":"fs.readFileSync(...): path must be a string or Buffer"},{"fix":"Use ES2015 import { readFileSync } from 'fs' instead.","cause":"brfs-babel encountered unsupported syntax like require('fs').readFileSync.","error":"Error: Could not transform: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}