smartbundle
raw JSON → 0.14.1 verified Sat Apr 25 auth: no javascript
Zero-config bundler for npm packages, version 0.14.1. Lean and minimal configuration approach compared to tsdx or microbundle. Actively maintained with monthly releases. Ships TypeScript declarations. Requires vitest ^3.0.0, typescript ^5.0.0, and @babel/core ^7.26.0 as peer dependencies since v0.14.0. Handles ESM, CJS, and TypeScript out of the box.
Common errors
error Error: Cannot find module 'smartbundle' ↓
cause Missing peer dependencies or ESM/CJS mismatch
fix
Install peer deps: npm install -D vitest@^3.0.0 typescript@^5.0.0 @babel/core@^7.26.0 and use ESM imports
error TypeError: smartbundle is not a function ↓
cause Using default import instead of named import
fix
Use named import: import { build } from 'smartbundle' instead of import smartbundle from 'smartbundle'
error Error: verbatimModuleSyntax is required ↓
cause TypeScript config missing verbatimModuleSyntax in v0.12.4+
fix
Add 'verbatimModuleSyntax': true to tsconfig.json compilerOptions
error Error: exports or bin is required ↓
cause package.json missing exports or bin field in v0.14.1+
fix
Add 'exports' or 'bin' field to package.json
Warnings
breaking Minimum peer dependency vitest v3 required since v0.14.0 ↓
fix Install vitest ^3.0.0 in your project: npm install -D vitest@^3.0.0
breaking Force verbatimModuleSyntax in TypeScript config since v0.12.4 ↓
fix Enable 'verbatimModuleSyntax' in tsconfig.json
breaking ESM-only package, require() will fail since v0.13.0 ↓
fix Replace require('smartbundle') with import statements or use dynamic import
gotcha exports or bin field required in package.json since v0.14.1 ↓
fix Ensure your package.json has either 'exports' or 'bin' field defined
deprecated createConfig function may be deprecated in future in favor of defineConfig ↓
fix Use defineConfig instead for future compatibility
Install
npm install smartbundle yarn add smartbundle pnpm add smartbundle Imports
- build wrong
const build = require('smartbundle')correctimport { build } from 'smartbundle' - createConfig wrong
import createConfig from 'smartbundle'correctimport { createConfig } from 'smartbundle' - defineConfig wrong
import { defineConfig } from 'smartbundle/config'correctimport { defineConfig } from 'smartbundle'
Quickstart
import { build, defineConfig } from 'smartbundle';
const config = defineConfig({
entry: 'src/index.ts',
formats: ['esm', 'cjs'],
outDir: 'dist',
tsconfig: 'tsconfig.json',
});
console.log('Building...');
build(config).then(() => console.log('Done!'));