Git Product home page Git Product logo

rollup-plugin-multi-entry's Introduction

Moved

This module has moved and is now available at @rollup/plugin-multi-entry. Please update your dependencies. This repository is no longer maintained.

rollup-plugin-multi-entry

Use multiple entry points in your rollup bundle. This is particularly useful for tests, but can also be used to package a library. The exports from all the entry points will be combined, e.g.

// a.js
export const a = 1;

// b.js
export const b = 2;

// c.js
export const c = 3;

Using all three files above as entry points will yield a bundle with exports for a, b, and c.

Note: Default exports like export default class Foo {...} will not be exported, only named exports are allowed.

Install

# Install via npm:
$ npm install [--save-dev] rollup-plugin-multi-entry
# Or use yarn:
$ yarn add [--dev] rollup-plugin-multi-entry

Usage

This plugin requires at least v0.48.0 of rollup. In rollup.config.js:

import multiEntry from "rollup-plugin-multi-entry";

export default {
  input: "test/**/*.js",
  plugins: [multiEntry()]
};

The entry above is the simplest form which simply takes a glob string. If you wish, you may pass an array of glob strings or, for finer control, an object with include and exclude properties each taking an array of glob strings, e.g.

// The usual rollup entry configuration works.
export default {
  input: 'just/one/file.js',
  plugins: [multiEntry()]
  // ...
};

// As does a glob of files.
export default {
  input: 'a/glob/of/files/**/*.js',
  plugins: [multiEntry()]
  // ...
};

// Or an array of files and globs.
export default {
  input: ['an/array.js', 'of/files.js', 'or/globs/**/*.js'],
  plugins: [multiEntry()]
  // ...
};

// For maximum control, arrays of globs to include and exclude.
export default {
  input: {
    include: ['files.js', 'and/globs/**/*.js', 'to/include.js'],
    exclude: ['those/files.js', 'and/globs/*.to.be.excluded.js']
  },
  plugins: [multiEntry()]
  // ...
};

Sometimes you may not want to export anything from the rolled-up bundle. In such cases, use the exports: false option like so:

export default {
  input: "src/*.js",
  plugins: [multiEntry({ exports: false })]
};

License

MIT

rollup-plugin-multi-entry's People

Contributors

eventualbuddha avatar lukastaegert avatar shellscape avatar tomkel avatar treeno avatar trysound avatar vinkla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.