node package manager



Pundle is a next generation module bundler. It's written with extensibility and performance in mind and out performs any other bundler out there.


npm install -g pundle

Example CLI Usage

$ mkdir -p /tmp/pundle-example-test
$ cd /tmp/pundle-example-test
$ echo '{}' > package.json
$ echo 'console.log(require("react"))' > index.js
$ npm install react
$ pundle --source-map

CLI Usage

$ pundle --help

  Usage: pundle [options]


    -h, --help                          output usage information
    -V, --version                       output the version number
    -e, --entry [path]                  Pundle entry points
    -p, --path-type <number|filePath>   Output path type
    -r, --root-directory <directory>    Root directory of which all imports would be relative of
    -m, --module-directory [directory]  Directories to search for during module lookup
    -s, --source-map                    Generate source map for output
    --project-name <name>               Project name to show in source map paths
    -o, --output-file <path>            The path to store generated output at
    --source-map-inline                 Wether to output inline source map
    --source-map-output-file <path>     The path to store source map of generated output at
    -w, --watch                         Watch given entry files and recompile on change
    --use-polling                       Use Polling method when watching files

$ pundle --source-map --entry index.js --output-file bundle.js --source-map-output-file
$ pundle --source-map --entry index.js --output-file bundle.js --source-map-output-file --watch

Example API Usage

import Pundle from 'pundle'
const pundle = new Pundle({
  entry: ['index.js'],
  pathType: 'filePath',
  rootDirectory: process.cwd(),
  moduleDirectories: ['node_modules'],
  ['babel-pundle', {
    config: {
      presets: ['steelbrain']
]).then(function() {
  return pundle.compile()
}).then(function() {
    // These are just examples.  pundle-coffee and pundle-less don't exist yet =) 
    { extensions: ['.coffee'], loader: require('pundle-coffee') },
    { extensions: ['.less'], loader: require('pundle-less') },
  return pundle.generate({ sourceMap: true })
}).then(function(generated) {
  FS.writeFileSync('./bundle.js', `${generated.contents}\n//#`)
  FS.writeFileSync('./', generated.sourceMap)
}).catch(function(error) {
  console.error('error', error)

API Usage

type GeneratorConfig = {
  contents?: Array<File>,
  requires?: Array<string>,
  wrapper?: 'none' | 'hmr' | 'normal',
  sourceMap: boolean,
  projectName?: string,
type WatcherConfig = {
  usePolling?: boolean,
  ready?: (() => any),
  error: ((error: Error) => any),
  generate: (() => any),
type PundleConfig = {
  entry: Array<string> | string,
  pathType?: 'number' | 'filePath',
  rootDirectory: string,
  replaceVariables?: Object,
  moduleDirectories?: Array<string>,
export default class Pundle {
  constructor( config: PundleConfig )
  async compile(): Promise<void>
  generate( config: GeneratorConfig ): { sourceMap: ?Object, contents: string }
  watch( config: WatcherConfig ): { queue: Promise<void>, subscription: Disposable }
  loadLoaders(loaders): Array<string>
  loadPlugins(plugins): Promise
  clearCache(): void
  dispose(): void

Env Variables

Pundle responds to these environment variables


Set this environment variable to make pundle use polling based File System watching.


This project is licensed under the terms of MIT License. See the LICENSE file at the root of the Github repo for more info.