rollup-all
v1.10.6
Published
A lightweight, extensive and configurable npm package for building all your ES6 source codes in one parse using rollup
Downloads
136
Maintainers
Readme
Rollup-all
Overview
Rollup-all is an out of the box package for building all your shiny Javascript/Typescript library source codes in one parsing, allowing you to generate commonjs, es module, and browser builds at once. It is very configurable and runs asynchronously.
It allows you to configure the build process, letting you define what should be included and excluded in the build, if sourcemap should be generated, if minified versions of the build should be generated, if asset and type definition files should be copied over, and lots more...
It comes with all needed configurations already done for you, including support for typescript projects. It uses Rollup's JavaScript API to automate the build process.
Getting Started
npm install --save-dev rollup-all
Next, add the build script to your package.json file
{
"scripts": {
"build": "rollup-all"
}
}
Advanced Configuration
In case you need to do some other configurations, such as passing extra babel presets, babel plugins, rollup plugins, and build config, then you can create
a rollup.config.js
file at the root of your project. Like shown below:
const { config } = require('rollup-all');
module.exports = config(options);
The above code is the way to configure the build process. The good thing is that it is self documented, because it is a typescript project, and has typings generated.
Below is a brief documentation of the options object.
The Options Object
The options object takes two objects, config
and babelConfig
.
- Babel Config
Babel config object takes presets array and plugins array. These are added to the already existing presets and plugins used internally.
By default, The following presets are added automatically:
The following babel plugins are added automatically:
Config
The config object is where you configure build specific options, and also where you extend the rollup plugins. it accepts a plugins array, that are added to the already used plugins. Below is a list of already added plugins
rollup-plugin-babel
@rollup/plugin-commonjs
@rollup/plugin-node-resolve
rollup-plugin-terser
@rollup/plugin-json
The config option takes other configuration options, such as sourcemap
option, interop
, uglify
, assets
array, distConfig
options (where you can configure options specifically for browser builds, such as externals). etc. Note that distConfig.enabled
options is set to false by default.
Contributing
We welcome your own contributions, ranging from code refactoring, documentation improvements, new feature implementations, bugs/issues reporting, etc. Thanks in advance!!!