Skip to content
No description, website, or topics provided.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Tidy Examples Jan 6, 2020
lib Chokidar speed improvement for pnpm Jan 23, 2020
test Fixed tests Jan 23, 2020
.gitignore 0.7.2 Sep 8, 2019
.npmignore 0.8.1 Oct 24, 2019
.travis.yml Console testing Oct 20, 2018
API.md Merge pull request #58 from PepsRyuu/ManualChunks Jan 5, 2020
LICENSE Initial commit Feb 18, 2018
README.md 0.6.0 May 28, 2019
package.json 0.10.3 Jan 23, 2020

README.md

Nollup

Build Status NPM Version License

Rollup compatible bundler, designed to be used in development, while Rollup is used to generate a production build.

Motivation

  • Rollup is excellent, but during development it can be a bit slow as it's performing unnecessary build steps (tree-shaking).
  • When making changes to files, Rollup has to recompile the entire bundle due to the tree-shaking optimisations. This can lead to slow rebuild times.
  • Wanted something similar to Webpack development flow, but with the simplicity of the Rollup configuration and plugin ecosystem.
  • To give developers a foundation for implementing Hot Module Replacement when using Rollup.
  • While Rollup does have watching functionality, it writes to disk and isn't intended to be used in-memory.

What does this do?

  • Nollup doesn't attempt to do any optimisations, it simple concatenates all of the modules together with simple function wrappers.
  • ES6 import and export statements are detected and replaced with an internal module loader.
  • Each module is wrapped in an eval call with source maps.
  • Compatible with Rollup plugins, so you can use one single Rollup configuration for both development and production. Make sure the plugin uses emitAsset instead of writing to disk.
  • Detects changed files, and performs a rebuild and has support for Hot Module Replacement.

Examples

See examples directory on how to use.

CLI

Nollup provides a dev server which can be used as a CLI command.

    "scripts": {
        "start": "nollup -c"
    }

See "Nollup Options" for list of available flags.

.nolluprc

Configuration file that can be used to pass configuration instead of as flags through the CLI.

{
    "hot": true,
    "contentBase": "./public"
}

A JavaScript file called .nolluprc.js can be used instead.

module.exports = {
    hot: true,
    contentBase: './public'
};

See "Nollup Options" for list of available options.

Nollup Options

  • String config | -c | --config [file] - Pass a configuration file. By default it will look for rollup.config.js but can be specified otherwise.
  • String contentBase | --content-base [folder] - Folder to serve static content from. By default it will be looking in './.
  • Boolean historyApiFallback | --history-api-fallback - If set, it will fallback to index.html if accessing a route that doesn't exist.
  • Boolean hot | --hot - Enable Hot Module Replacement.
  • Number port | --port [value] - Port number to run server on. Default is 8080.
  • Boolean verbose | --verbose - If set, there's verbose logging.
  • Object proxy - Object keys are paths to match. Value is domain to redirect to. "/api": "http://localhost:8080" will have a request such as /api/todos redirect to http://localhost:8080/api/todos
  • String hmrHost | --hmr-host [host] - Host to connect to for HMR. Default is window.location.host.
  • Function before - Receives Express app as argument. Allows for middleware before internally used middleware.
  • Function after - Receives Express app as argument. Allows for middleware after internally used middleware.

API

See API for information on how to use the JavaScript API.

Rollup Plugins with Nollup Enhancements

Caveats

  • Not all Rollup configuration options are supported yet.
  • Not all Rollup plugin hooks are implemented yet.
  • Sourcemaps aren't perfect yet, depends on plugin usage.
  • Does not attempt to parse "require" calls anywhere.
  • No support for live-bindings, but circular dependencies are supported.

Contributions are welcome.

You can’t perform that action at this time.