{"id":12938,"library":"bundt","title":"Bundt Module Bundler","description":"Bundt is a minimalistic JavaScript module bundler designed for simplicity and focused on efficient module processing. As of version 1.1.5, it provides core bundling capabilities suitable for libraries and smaller applications, emphasizing a straightforward API rather than extensive configuration. It maintains an active release cadence, with recent patches addressing minor bugs and edge cases related to import/export rewriting. Its primary differentiator is its lightweight nature, offering a less opinionated alternative to larger bundlers like Webpack or Rollup, particularly for scenarios where complex build pipelines are not required. It aims to deliver modules without excessive overhead or configuration.","status":"active","version":"1.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/lukeed/bundt","tags":["javascript","bundler","release","library","targets"],"install":[{"cmd":"npm install bundt","lang":"bash","label":"npm"},{"cmd":"yarn add bundt","lang":"bash","label":"yarn"},{"cmd":"pnpm add bundt","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Bundt is primarily designed for modern Node.js environments and ESM. While Node.js >=6 is stated, programmatic usage is typically via ESM imports.","wrong":"const bundt = require('bundt');","symbol":"bundt","correct":"import { bundt } from 'bundt';"},{"note":"For TypeScript users, import the `Options` interface to type the configuration object passed to the `bundt` function.","symbol":"Options","correct":"import type { Options } from 'bundt';"},{"note":"The `bundt` function is asynchronous and returns a Promise, which should be `await`ed or handled with `.then()`/`.catch()`.","symbol":"bundt (async)","correct":"await bundt({ entry: '...', output: '...' });"}],"quickstart":{"code":"import { bundt } from 'bundt';\nimport * as path from 'path';\nimport * as fs from 'fs/promises';\n\nasync function buildMyProject() {\n  const entryFile = path.resolve('./src/index.js');\n  const outputDir = path.resolve('./dist');\n  const outFile = path.join(outputDir, 'bundle.js');\n\n  try {\n    // Ensure the output directory exists\n    await fs.mkdir(outputDir, { recursive: true });\n\n    await bundt({\n      entry: entryFile,\n      output: outFile,\n      format: 'esm', // or 'cjs', 'iife'\n      sourcemap: true, // Example option for sourcemap generation\n      // Additional options like 'treeshake', 'minify' could be added here\n    });\n    console.log(`✅ Successfully bundled ${entryFile} to ${outFile}`);\n  } catch (error) {\n    console.error('❌ Bundling failed:', error);\n    process.exit(1);\n  }\n}\n\nbuildMyProject();","lang":"typescript","description":"Demonstrates how to programmatically use Bundt to bundle a JavaScript entry file into an output bundle, specifying format and sourcemap options."},"warnings":[{"fix":"Review code for `import` or `export` statements embedded in string literals or template literals. Ensure they conform to expected module syntax and are not being unintentionally rewritten.","message":"Version 1.1.3 introduced changes to how `import` and `export` statements are rewritten, particularly concerning statements within strings or template literals. This could lead to different bundling behavior or errors if relying on previous parsing quirks.","severity":"breaking","affected_versions":">=1.1.3"},{"fix":"For complex projects requiring advanced optimizations, extensive plugin support, or specific framework integrations, consider evaluating more feature-rich bundlers. For simpler libraries or applications, Bundt's minimalistic approach can be advantageous.","message":"Bundt is described as a 'simple' bundler. It may lack advanced features, such as extensive plugin ecosystems, highly configurable code splitting, or deep integration with various framework-specific tools, common in larger bundlers like Webpack or Rollup. Users coming from these tools might find limitations for complex build requirements.","severity":"gotcha","affected_versions":"*"},{"fix":"Explicitly set the `format` option to match your target environment. If mixing CJS and ESM, verify Bundt's behavior or pre-process modules to a consistent format if issues arise.","message":"While Bundt supports different module `format` options ('esm', 'cjs', 'iife'), ensure your input modules and target environment's expectations align. Mismatched module types (e.g., ESM input targeting a pure CJS output without proper transpilation) can lead to runtime errors or unexpected behavior.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Verify the module path is correct relative to the importing file or specified in `entry` option. Ensure the file actually exists on the filesystem.","cause":"The bundler could not locate a referenced module due to an incorrect path or missing file.","error":"Error: Cannot resolve './my-module.js' from 'path/to/entry.js'"},{"fix":"Ensure your Node.js environment supports ESM if you're directly running bundled ESM code. If using Bundt, check the `format` option in your configuration; set it to 'cjs' if targeting a CommonJS environment.","cause":"This usually indicates that ESM syntax (like `export` or `import`) is being parsed in an environment that only supports CommonJS, or the bundler's output format is incorrect.","error":"SyntaxError: Unexpected token 'export' (or 'import')"},{"fix":"Use `import { bundt } from 'bundt';` for modern Node.js environments. Ensure your file is treated as an ESM module (e.g., `.mjs` extension or `\"type\": \"module\"` in `package.json`).","cause":"The `bundt` function was not imported correctly, or the module context is incorrect (e.g., trying to `require` an ESM-only package in a pure CJS file).","error":"TypeError: bundt is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}