Nollup: Rollup-compatible Dev Bundler

0.21.0 · active · verified Tue Apr 21

Nollup is a Rollup-compatible bundler specifically engineered for rapid development workflows, currently at version 0.21.0. Unlike Rollup, which focuses on production-optimized bundles through aggressive tree-shaking and scope-hoisting, Nollup intentionally skips these optimizations to achieve exceptionally fast rebuild times. This makes it ideal for local development, enabling features like Hot Module Replacement (HMR) using existing `module.hot` conventions. It maintains compatibility with standard Rollup plugins and configuration files, allowing developers to leverage their existing Rollup ecosystem for application development. Nollup offers several modes of operation, including a CLI, Dev Server API, Dev Middleware API, and Compiler API, supporting frequent releases with a focus on developer experience.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to programmatically set up and start a Nollup development server using its `createServer` API, along with a minimal Rollup configuration and sample client-side files for a web application. It includes HMR and content serving from a public directory.

import { createServer } from 'nollup';
import path from 'path';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

// Minimal rollup config (e.g., rollup.config.js)
const rollupConfig = {
  input: path.resolve(__dirname, 'src/main.js'),
  output: {
    file: 'dist/bundle.js',
    format: 'esm',
    sourcemap: true,
  },
  plugins: [], // Add your Rollup plugins here, e.g., @rollup/plugin-node-resolve(), @rollup/plugin-commonjs()
};

// Create a basic server.js file to start Nollup
async function startDevServer() {
  const server = await createServer({
    config: rollupConfig,
    port: process.env.PORT ?? 9000,
    contentBase: path.resolve(__dirname, 'public'),
    hot: true, // Enable Hot Module Replacement
  });

  server.listen();
  console.log(`Nollup dev server listening on http://localhost:${server.port}`);
}

startDevServer().catch(console.error);

// --- src/main.js ---
// console.log('Hello from Nollup!');
// document.body.innerHTML = '<h1>Hello Nollup Dev!</h1>';

// --- public/index.html ---
// <!DOCTYPE html>
// <html lang="en">
// <head>
//     <meta charset="UTF-8">
//     <meta name="viewport" content="width=device-width, initial-scale=1.0">
//     <title>Nollup App</title>
// </head>
// <body>
//     <script src="/dist/bundle.js"></script>
// </body>
// </html>

// To run:
// 1. Create files: server.js, src/main.js, public/index.html as above.
// 2. Add "type": "module" to your package.json.
// 3. Install: npm install nollup
// 4. Run: node server.js

view raw JSON →