Giter Club home page Giter Club logo

rollup-plugin-multi-input's Introduction

rollup-plugin-multi-input

CI/CD codecov npm version semantic-release dependencies Status devDependencies Status

A rollup plugin to bundle libraries with multiple dist files.

  • Use multiple entry points.
  • Use glob in entries.
  • Preserve src three structure in the dist folder.

Install

Install via npm or yarn.

npm i -D rollup-plugin-multi-input
yarn add rollup-plugin-multi-input

Setup

In the rollup configuration

import multiInput from 'rollup-plugin-multi-input';

export default {
    // use glob in the input
    input: ['src/**/*.js'],
    output: {
      format: 'esm',
      dir: 'dist'
    },
    plugins: [ multiInput() ],
};

If using a rollup version lower than 1.0.0 enable experimentalCodeSplitting.

It's possible to mix input type.

  • use glob in array
    input: ['src/**/*.js']
  • use object input configuration
    // DO ๐Ÿ‘
    input: [{
      output1: 'src/output1.js'
    }]
    // DON'T โŒ (glob not supported yet)
    input: [{
      output1: 'src/**/*.js'
    }]
  • use glob string and object configuration
    input: ['src/more/**/*.js', 'src/more2/**/*.js', {
      output1: 'src/output1.js'
    }]

Options

relative 'src/'

Specific the relative path to use in the dist folder.

Example:

import multiInput from 'rollup-plugin-multi-input';

export default {
    input: ['src/bar.js', 'src/foo/bar.js'],
    output: {
      format: 'esm',
      dir: 'dist'
    },
    plugins: [ multiInput({ relative: 'src/' }) ],
};
// create the files dist/bar.js and dist/foo/bar.js

transformOutputPath

A callback for transforming output file path.

Example:

import multiInput from 'rollup-plugin-multi-input';
import path from 'path';

export default {
    input: ['src/bar.js', 'src/foo/bar.js'],
    output: {
      format: 'esm',
      dir: 'dist'
    },
    plugins: [ multiInput({ 
        relative: 'src/', 
        transformOutputPath: (output, input) => `awesome/path/${path.basename(output)}`, 
    }) ],
};
// create the files dist/bar.js and dist/foo/bar.js

glob {}

fast-glob object configuration.

rollup-plugin-multi-input's People

Contributors

alfredosalzillo avatar dependabot-preview[bot] avatar eugeneross avatar joycebabu avatar

Stargazers

 avatar

Watchers

 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.