rollup-plugin-multi-input
rollup plugin for multiple input using glob, ideal for build libraries with multiple dist files
Last updated 3 months ago by alfredo.salzillo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rollup-plugin-multi-input 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.1.1                                ...           latest (3 months ago)

16 Versions

  • 1.1.1                                ...           3 months ago
  • 1.1.0                                ...           3 months ago
  • 1.0.3                                ...           7 months ago
  • 1.0.2                                ...           a year ago
  • 1.0.2-alpha-1                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.3-alpha                                ...           a year ago
  • 0.0.2-alpha                                ...           a year ago
  • 0.0.1-alpha                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 38
This Month 38
Last Day 3
Last Week 19
Last Month 73
Dependencies (4)
Dev Dependencies (15)

Copyright 2014 - 2016 © taobao.org |