Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 1.67 KB

README.md

File metadata and controls

78 lines (53 loc) · 1.67 KB

npm size

rollup-plugin-rollup

🍣 A Rollup plugin which imports a Rollup bundle as a string.

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.

Install

Using npm:

npm install rollup-plugin-rollup --save-dev

Usage

Assuming a src/index.js exists and contains code like the following:

import miner from './miner.rollup';
import { worker } from 'shumei';

worker.dedicated(miner);

And a src/miner.js exists and contains code like the following:

import { worker } from 'shumei';

const [tx, rx] = worker.channel();

for await (const msg of rx) {
  console.log(msg);
}

And a src/miner.rollup exists and contains code like the following:

import resolve from '@rollup/plugin-node-resolve';

export default {
  input: 'src/miner.js',
  plugins: [resolve()]
};

Create a rollup.config.js configuration file and import the plugin:

import rollup from 'rollup-plugin-rollup';

export default {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs'
  },
  plugins: [rollup()]
};

Then call rollup either via the CLI or the API.

Options

No options at the moment.