npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

rollup-worker

1.0.8 • Public • Published

rollup-worker

Rollup worker for multiple entry bundle with customize distributes.

Installation

$
 
npm i -g rollup-worker@next
 
rollup-worker --config <CONFIG_FILE.js>

Usage

rollup config file

// cat .fssrc.js
import path from 'path'
import coffee from 'rollup-plugin-coffee-script'
 
const { version, name, author, dependencies } = require('./package.json')
 
// add some customize plugins with builtins
const plugins = [
  coffee(),
  'resolve',
  'commonjs'
]
 
const babelConfig = { ... }
 
module.exports = {
  rollup: {
    destDir: path.join(__dirname, './'),
    pluginOptions: {
      babel: (rollupCfg) => {
        const babelrc = Object.assign({}, babelConfig)
        if ([ 'es', 'cjs' ].includes(rollupCfg.output.format)) {
          babelrc.comments = true
        }
        return babelrc
      },
      nodeResolve: (rollupCfg) => {
        const format = rollupCfg.output.format
        return {
          preferBuiltins: false,
          customResolveOptions: {
            moduleDirectory: /min|umd|iife/.test(format) ? [ 'src', 'node_modules' ] : [ 'src' ]
          }
        }
      },
      uglifyjs: {
        ie8: false
      }
    },
    entry: [
      {
        input: './pace.coffee',
        plugins,
        output: [
          {
            format: 'es',
            file: 'pace.esm.js'
          },
          {
            format: 'umd',
            name: 'Pace',
            file: 'pace.js',
            banner: `/*! ${name} v${version} | ${license || 'MIT'} Licensed. | By ${author} */\n`
          }
        ]
      },
      {
        input: './docs/lib/themes.coffee',
        plugins,
        output: [
          {
            format: 'iife',
            minimize: true,
            file: 'docs/lib/themes.js'
          }
        ]
      }
    ]
  }
}
// cat build.js
 
'use strict'
 
const Rollup = require('rollup-worker')
const config = require('./.fssrc.js')
 
const worker = new Rollup(config.rollup)
worker.build().then(err => console.error(err))

License

MIT

install

npm i rollup-worker

Downloadsweekly downloads

22

version

1.0.8

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability