Loading…
Loading…
Bundler & Dev Server
An incremental bundler and dev server written in Rust and Zig, built into PledgeJS. Oxc for transforms, Lightning CSS for styles, Axum for the dev server, and a Zig C ABI for hot-path file I/O and SIMD scanning.
PledgePack is the default bundler in PledgeJS — no configuration needed. It replaces Vite, webpack, and Rollup with a single native toolchain.
A single, unified module graph for client, server, and edge environments — no stitching multiple compiler bundles together.
Work is parallelized across cores and cached down to the function level. Once a piece of work is done, PledgePack never repeats it. Results persist to disk between runs.
PledgePack only bundles what the dev server actually requests, cutting initial compile times and memory usage for large apps.
A Zig C ABI handles file I/O, module graph traversal, SIMD source scanning, and memory-mapped reads — zero-cost FFI into the Rust orchestrator.
PledgePack ships platform-specific native bindings. On platforms without native bindings, PledgeJS falls back to WebAssembly for core Oxc features (compilation, minification) — but PledgePack itself requires native bindings.
| Platform | Architecture |
|---|---|
| macOS (Darwin) | x64, ARM64 |
| Windows | x64, ARM64 |
| Linux (glibc) | x64, ARM64 |
| Linux (musl) | x64, ARM64 |
PledgePack is the default bundler in PledgeJS. No configuration is needed — just run the CLI.
{
"scripts": {
"dev": "pledgepack dev",
"build": "pledgepack build",
"serve": "pledgepack serve"
}
}Install globally or as a dev dependency:
npm install -g pledgepack
# or
npm install --save-dev pledgepackZero-configuration for the common use cases. Below is a summary of what is supported out of the box.
| Feature | Status | Notes |
|---|---|---|
| JavaScript & TypeScript | Supported | Oxc under the hood. Type-checking is not done by PledgePack (run tsc --watch or rely on your IDE). |
| ECMAScript (ESNext) | Supported | Latest ECMAScript features, matching Oxc's coverage. |
| CommonJS | Supported | require() syntax handled out of the box. |
| ESM | Supported | Static and dynamic import fully supported. |
| Feature | Status | Notes |
|---|---|---|
| JSX / TSX | Supported | Oxc handles JSX/TSX compilation. |
| Fast Refresh | Supported | React component state preservation via the React adapter. |
| React Server Components (RSC) | Supported | Correct server/client bundling via the Next.js and PledgeJS adapters. |
| Solid JSX | Supported | Automatic JSX runtime with solid-js via the Solid adapter. |
| Vue SFC | Transform | .vue Single-File Components, scoped CSS, script setup. |
| Svelte SFC | Transform | .svelte SFCs, scoped CSS, render functions. |
| Astro | Transform | .astro frontmatter, islands-ready. |
| Feature | Status | Notes |
|---|---|---|
| Global CSS | Supported | Import .css files directly. |
| CSS Modules | Supported | .module.css scoped class names with blake3 content hashing. |
| CSS Nesting | Supported | Modern CSS nesting via Lightning CSS. |
| @import syntax | Supported | Combine multiple CSS files. |
| PostCSS / Tailwind | Supported | @tailwind directives, @apply expansion, base reset, utility classes. |
| Sass / SCSS | Supported | Compilation via the grass crate (pure Rust). |
The CLI command is pledge (alias: pledgepack).
| Command | Description |
|---|---|
| pledgepack dev | Start the dev server with HMR on port 3000. |
| pledgepack dev --port 8080 | Custom port. |
| pledgepack dev --https | HTTPS with self-signed certs via rustls. |
| pledgepack build | Production build to dist/. |
| pledgepack build --watch | Watch mode rebuilds. |
| pledgepack build --profile | Per-phase timing (parse, transform, optimize, emit). |
| pledgepack build --type-check | TypeScript type checking. |
| pledgepack build --check-budgets | Bundle size budgets. |
| pledgepack serve | Serve the production build on port 4000. |
| pledgepack preview | Alias for serve. |
| pledgepack create react my-app | Scaffold a React app. |
| pledgepack create pledgejs my-app | Scaffold a PledgeJS app (default). |
| pledgepack test | Run tests with a Vitest-compatible API. |
| pledgepack bench | Benchmark build performance. |
| pledgepack analyze --graph | Bundle analyzer with dependency graph. |
| pledgepack cache clear | Clear the disk cache. |
| pledgepack doctor | Diagnose build issues. |
| pledgepack migrate | Migrate from Vite / webpack / CRA. |
Configure PledgePack via pledge.config.ts. Resolution order: pledge.config.ts → .js → .mjs → pledge.json → defaults.
// pledge.config.ts
export default {
appDir: 'app',
framework: 'react',
sourceMaps: true,
envPrefix: 'PLEDGE_',
envDts: true,
htmlEntry: 'index.html',
compressGzip: true,
compressBrotli: true,
edgeTarget: 'cloudflare',
plugins: ['./plugins/my-plugin.ts'],
image: { quality: 80, webp: true, maxWidth: 1920, maxHeight: 1080 },
library: { entry: 'src/index.ts', formats: ['esm', 'cjs'], name: 'MyLib', external: ['react'], declarations: true },
https: { cert: './cert.pem', key: './key.pem' },
serverEntry: 'server/index.ts',
nodePolyfills: true,
define: { 'process.env.NODE_ID': '"production"', '__VERSION__': '"1.0.0"' },
watch: { enabled: false, debounceMs: 300 },
devServer: {
port: 3000,
host: 'localhost',
hmr: true,
open: false,
proxy: [{ path: '/api', target: 'http://localhost:8080', rewrite: true, ws: true }],
},
test: {
include: ['**/*.{test,spec}.{ts,tsx,js,jsx}'],
exclude: ['node_modules', '.pledge', 'dist'],
environment: 'node',
isolation: 'file',
coverage: false,
snapshot: true,
snapshotDir: '__snapshots__',
},
};Environment variables are injected via import.meta.env.*. Built-in variables: PLEDGE_DEV, PLEDGE_PROD, PLEDGE_MODE, MODE, DEV, PROD, SSR.
PledgePack is a Rust workspace. Use the crates programmatically for integrations — the npm package is a binary launcher and does not export JS functions.
Engine, config, transform pipeline, HTML, compression, analyzer.
Function-level incremental cache (memory + disk/bincode).
Module resolution (node_modules, tsconfig, exports).
Dev server + HMR + CSS HMR + error overlay + proxy.
Tree shaking, code splitting, vendor/shared chunks.
Vite-compatible JS plugin API (QuickJS via rquickjs).
WebAssembly plugin host.
React JSX + Fast Refresh adapter (Oxc-based).
Solid.js JSX adapter (Oxc-based).
Next.js adapter (App/Pages Router, SSR, API routes).
TanStack Router adapter (file-based routing).
PledgeJS adapter (React + Rust backend).
Parallel task execution engine.
Native-grade performance, incremental caching, and a Vite-compatible plugin API — all from a single Rust + Zig toolchain.