Minipac
raw JSON → 3.0.5 verified Sat Apr 25 auth: no javascript
Minimalistic web application bundler. Version 3.0.5 is the latest stable release. Provides a lightweight alternative to large bundlers like webpack or Rollup, focusing on simplicity and minimal configuration. Suitable for small to medium-sized projects. No frequent updates; maintained as a stable tool.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/minipac not supported. ↓
cause Package is ESM-only, cannot be required().
fix
Use
import minipac from 'minipac' instead of require('minipac'). error TypeError: minipac is not a function ↓
cause Default export changed to an object in v3; calling it as function fails.
fix
Use
import { bundle } from 'minipac' and call bundle(config). Warnings
breaking Default export changed from function to object in v3. ↓
fix Use named export `bundle` instead of calling default export directly.
deprecated `minipac({...})` sync API removed in v3. ↓
fix Use `bundle(config)` which returns a Promise.
gotcha Require() is not supported; package is ESM-only. ↓
fix Use `import` statements. If using CommonJS, use dynamic import: `import('minipac')`.
Install
npm install minipac yarn add minipac pnpm add minipac Imports
- minipac wrong
const minipac = require('minipac')correctimport minipac from 'minipac' - bundle wrong
const bundle = require('minipac').bundlecorrectimport { bundle } from 'minipac' - Config wrong
import { Config } from 'minipac'correctimport type { Config } from 'minipac'
Quickstart
import minipac from 'minipac';
import { bundle } from 'minipac';
const config = {
entry: './src/index.js',
output: './dist/bundle.js',
};
bundle(config).then(() => console.log('Bundled!'))
.catch(err => console.error(err));