{"id":16848,"library":"lofi-bundler","title":"Lofi Bundler","description":"Lofi Bundler is a minimalist TypeScript utility designed for projects that prioritize simplicity and a zero-dependency build process, especially when targeting browser environments or when complex module loaders are unnecessary. It operates by walking through all specified TypeScript files within a project (explicitly excluding `node_modules` and other external folders) and concatenating their content into a single TypeScript bundle. This bundled file can then be fed into the standard TypeScript compiler (`tsc`) for final compilation, eliminating the need for more elaborate bundling solutions like Webpack, Rollup, or even Babel configurations. The package's current stable version is 1.0.1, suggesting a mature, feature-complete state with an infrequent release cadence focused on stability. Its primary differentiator lies in its 'lofi' philosophy: a bare-bones approach that avoids external dependencies and configuration overhead, making it ideal for small, self-contained utilities or libraries that need to run in both Node.js and the browser without introducing complex build chains or module resolution challenges inherent to different environments.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/robertleeplummerjr/lofi-bundler","tags":["javascript","typescript","bundle","bundler","simple","zero","dependencies"],"install":[{"cmd":"npm install lofi-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add lofi-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add lofi-bundler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Lofi Bundler is primarily designed for TypeScript projects; use ESM imports for optimal integration. Default exports are not supported.","wrong":"const { traceConcat } = require('lofi-bundler');","symbol":"traceConcat","correct":"import { traceConcat } from 'lofi-bundler';"}],"quickstart":{"code":"{\n  \"name\": \"my-lofi-project\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"prebuild:browser\": \"rm -f bundle.ts\",\n    \"build:browser\": \"lofi-bundler && tsc bundle.ts --target es5 --module commonjs --outFile dist/browser-bundle.js\",\n    \"postbuild:browser\": \"rm bundle.ts\" \n  },\n  \"config\": {\n    \"lofi-bundler\": {\n      \"entry\": \"src/index.ts\",\n      \"target\": \"bundle.ts\",\n      \"include\": \"src/utils/*.ts\" \n    }\n  },\n  \"devDependencies\": {\n    \"lofi-bundler\": \"^1.0.0\",\n    \"typescript\": \"^5.0.0\"\n  }\n}\n\n// src/index.ts\nexport function sayHello(name: string): string {\n  return `Hello from Lofi Bundler, ${name}!`;\n}\n\n// src/utils/math.ts\nexport function add(a: number, b: number): number {\n  return a + b;\n}\n\n// To run:\n// 1. Save the above package.json\n// 2. Create src/index.ts and src/utils/math.ts with the content above.\n// 3. Run `npm install` or `yarn install`.\n// 4. Run `npm run build:browser` or `yarn build:browser`.\n// This will generate `dist/browser-bundle.js`.\n\n// Example of programmatic usage (optional, does not require package.json config)\n// import { traceConcat } from 'lofi-bundler';\n// import * as fs from 'fs';\n\n// async function generateBundleApi() {\n//   const entryFilePath = 'src/index.ts';\n//   const bundledSource = await traceConcat(entryFilePath);\n//   fs.writeFileSync('bundle-via-api.ts', bundledSource);\n//   console.log('Bundle generated via API to bundle-via-api.ts');\n// }\n// generateBundleApi();","lang":"typescript","description":"Demonstrates how to configure and run `lofi-bundler` via CLI in `package.json` scripts, including the subsequent `tsc` step for browser compatibility, and also shows programmatic API usage for direct integration."},"warnings":[{"fix":"Refactor your code to use named exports exclusively. For example, instead of `export default class MyClass {}`, use `export class MyClass {}`.","message":"Lofi Bundler explicitly does not support default exports. Using them will lead to unexpected naming or compilation errors, as the bundler is designed around named exports only.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your project truly has zero runtime dependencies, or manually manage external dependencies outside the lofi-bundler process (e.g., via `<script>` tags in HTML or a separate bundling step).","message":"This bundler is intentionally designed to process only files within your immediate project scope and explicitly excludes `node_modules` or other external folders. It is not suitable for bundling third-party npm dependencies.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always include `tsc` as a follow-up step in your build script after running `lofi-bundler`, configuring `tsc` with appropriate `--target` and `--module` options for your deployment environment.","message":"Lofi Bundler outputs a single TypeScript file. This intermediate file still requires a subsequent compilation step using `tsc` to be transformed into a runnable JavaScript file, especially for specific browser targets (e.g., ES5).","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Change all default exports to named exports. The bundler does not guarantee correct naming or resolution for default exports.","cause":"Attempting to use `export default` syntax in your TypeScript files.","error":"Error: Default exports are not supported."}],"ecosystem":"npm","meta_description":null}