Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-rollup

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-rollup

Rollup integration with broccoli

  • 1.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63K
decreased by-65.27%
Maintainers
3
Weekly downloads
 
Created

What is broccoli-rollup?

broccoli-rollup is a Broccoli plugin that allows you to use Rollup to bundle your JavaScript files. It integrates the Rollup module bundler into the Broccoli build pipeline, enabling you to take advantage of Rollup's features such as tree-shaking, code-splitting, and plugin support within a Broccoli-based build system.

What are broccoli-rollup's main functionalities?

Basic Usage

This example demonstrates the basic usage of broccoli-rollup. It sets up a Rollup build that takes an input file 'src/main.js' and outputs a bundled file 'bundle.js' in CommonJS format. It also includes plugins for resolving node modules and converting CommonJS modules to ES6.

const Rollup = require('broccoli-rollup');
const nodeResolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');

const tree = new Rollup('src', {
  rollup: {
    input: 'src/main.js',
    output: {
      file: 'bundle.js',
      format: 'cjs'
    },
    plugins: [
      nodeResolve(),
      commonjs()
    ]
  }
});

module.exports = tree;

Tree-shaking

This example shows how to enable tree-shaking with broccoli-rollup. Tree-shaking is a feature that eliminates dead code from the final bundle, making it smaller and more efficient. The 'treeshake' option is set to true in the Rollup configuration.

const Rollup = require('broccoli-rollup');

const tree = new Rollup('src', {
  rollup: {
    input: 'src/main.js',
    output: {
      file: 'bundle.js',
      format: 'es'
    },
    treeshake: true
  }
});

module.exports = tree;

Code-splitting

This example demonstrates how to use code-splitting with broccoli-rollup. Code-splitting allows you to split your code into multiple bundles, which can be loaded on demand. The 'experimentalCodeSplitting' option is enabled in the Rollup configuration.

const Rollup = require('broccoli-rollup');

const tree = new Rollup('src', {
  rollup: {
    input: 'src/main.js',
    output: [
      {
        dir: 'dist',
        format: 'es'
      }
    ],
    experimentalCodeSplitting: true
  }
});

module.exports = tree;

Other packages similar to broccoli-rollup

Keywords

FAQs

Package last updated on 01 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc