Rocket Logo Rocket Guides Docs Blog Toggle darkmode

Tools: Rollup Config

Rollup configuration to help you get started building modern web applications. You write modern JavaScript using the latest browser features. Rollup will optimize your code for production and ensure it runs on all supported browsers.


  • Set HTML or JavaScript as input and/or output
  • Optimized for browsers which support modules
  • Loads polyfills using feature detection
  • Minifies JavaScript
  • Minifies lit-html templates


  1. Install dependencies

    npm i -D rollup @rocket/building-rollup rollup @web/dev-server rimraf
  2. Create a rollup.config.js file:

    import { createSpaConfig } from '@rocket/building-rollup';
    // use `import { createBasicConfig }` to do regular JS to JS bundling
    // use `import { createMpaConfig }` to bundle multiple HTML files
    export default createSpaConfig({
      input: 'index.html',
      output: {
        dir: 'dist',
      // use all options from
  3. Add the following NPM scripts to your package.json:

      "scripts": {
        "build": "rimraf dist && rollup -c rollup.config.js",
        "start:build": "npm run build && web-dev-server --root-dir dist --app-index index.html --open"


Our config sets you up with good defaults for most projects. Additionally you can add more plugins and adjust predefined plugins or even remove them if needed.

We use the plugins-manager for it.

Customizing the Babel Config

You can define custom babel plugins to be loaded by adding a .babelrc or babel.config.js to your project. See babeljs config for more information.

For example to add support for class properties:

  "plugins": ["@babel/plugin-proposal-class-properties"]

Customizing Default Plugins

Our config creators install a number of Rollup plugins by default:

Basic, SPA and MPA plugins:

SPA and MPA plugins:

You can customize options for these plugins by using adjustPluginOptions.

import { createSpaConfig } from '@rocket/building-rollup';

export default createSpaConfig({
  setupPlugins: [adjustPluginOptions('node-resolve', { dedupe: ['lit-html'] })],