Pundle Middleware
raw JSON → 0.2.15 verified Sat Apr 25 auth: no javascript
Express middleware for Pundle, a JavaScript bundler. Provides development server integration with Express, enabling features like HMR and file serving. The package is part of the Pundle ecosystem, which is an alternative to Webpack. As of version 1.0.0 (stable), it is designed for advanced users. The v2.0.0-alpha1 release includes breaking changes with a complete architecture rebuild. Release cadence is sporadic with major gaps between versions. Differentiators: tight integration with Pundle's modular component system and presets.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module ↓
cause Using CommonJS require with ESM-only package
fix
Switch to import syntax or use dynamic import().
error Cannot find module 'pundle' ↓
cause Pundle core not installed as dependency
fix
Run: npm install pundle
Warnings
breaking v2.0.0-alpha1 completely rebuilt; API is incompatible with v1.x ↓
fix Check changelog for migration guide; use v1.x if stable required.
deprecated Named export createMiddleware may be deprecated in favor of default export ↓
fix Use default import to ensure compatibility.
gotcha Package is ESM-only; using require() will throw Error [ERR_REQUIRE_ESM] ↓
fix Use import or configure CommonJS interop.
Install
npm install pundle-middleware yarn add pundle-middleware pnpm add pundle-middleware Imports
- default wrong
const pundleMiddleware = require('pundle-middleware')correctimport pundleMiddleware from 'pundle-middleware' - createMiddleware wrong
import { createMiddleware } from 'pundle-middleware'correctimport { createMiddleware } from 'pundle-middleware' - PundleMiddlewareOptions wrong
import { PundleMiddlewareOptions } from 'pundle-middleware'correctimport type { PundleMiddlewareOptions } from 'pundle-middleware'
Quickstart
import express from 'express';
import pundleMiddleware from 'pundle-middleware';
import { createPundle } from 'pundle';
const app = express();
const pundle = createPundle({
entry: './src/index.js',
output: { format: 'esm', dir: './dist' },
});
app.use(pundleMiddleware(pundle, {
hmr: true,
watch: true,
}));
app.listen(3000);