Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mprt-org/rollup-plugin-incremental
A Rollup plugin which makes your (development) builds much faster, by recompiling only changed modules.
https://github.com/mprt-org/rollup-plugin-incremental
Last synced: 25 days ago
JSON representation
A Rollup plugin which makes your (development) builds much faster, by recompiling only changed modules.
- Host: GitHub
- URL: https://github.com/mprt-org/rollup-plugin-incremental
- Owner: mprt-org
- Created: 2020-10-26T17:26:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-15T09:41:42.000Z (over 3 years ago)
- Last Synced: 2024-11-11T21:25:03.461Z (about 1 month ago)
- Language: JavaScript
- Size: 444 KB
- Stars: 28
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - incremental - Recompile only changed modules in watch mode. (Plugins / Workflow)
README
[npm]: https://img.shields.io/npm/v/@mprt/rollup-plugin-incremental
[npm-url]: https://www.npmjs.com/package/@mprt/rollup-plugin-incremental
[![npm][npm]][npm-url]# @mprt/rollup-plugin-incremental
A Rollup plugin which makes your (development) builds much faster, by recompiling only changed modules.## Requirements
This plugin requires at least [email protected]
## Install
Using yarn or npm:
```console
yarn add -D @mprt/rollup-plugin-incrementalnpm install @mprt/rollup-plugin-incremental --save-dev
```## Usage
```js
//some imports ...
import incremental from '@mprt/rollup-plugin-incremental'export default {
input: 'src/index.js',
//ATTENTION: treeshaking must be disabled!
treeshake: false,
//ATTENTION: there is must be only one output!
output: {
dir: 'dist',
format: 'esm',
//ATTENTION: preserveModules must be enabled!
preserveModules: true,
preserveModulesRoot: 'src',
//ATTENTION: minifyInternalExports must be disabled!
minifyInternalExports: false,
},
plugins: [
//ATTENTION: plugin very likely should be first!
//BTW, this plugin is noop without watch mode
incremental(),
//another plugins...
//ATTENTION: this fixes issues with syntheticNamedExports in commonjs modules
//it should be last
incremental.fixSNE(),
],
}
```
And then...
```console
rollup -cw
```
NOTE: You MUST use watch mode with this plugin.There is simple typical ts, react and mobx web app in example folder.
First build will take same time as usual, but second and next builds should be really fast - below a second.
## Gotchas
- If changed file is not directly transpiles to module (ie: some babel config), then full rebuild triggered.
- If error occurs during incremental build, all changed modules will be rebuild again on next build
- Currently it works by replacing `input` option on incremental builds, so it cannot work with another plugins which
works with `input`, i.e. multi-entry plugin## Inter-plugin API
This plugin exposes next [API](https://rollupjs.org/guide/en/#direct-plugin-communication):
```ts
interface IncrementalAPI {
/** Is current (or last, if there is no current) build is incremental? */
readonly incrementalBuild: boolean
/** Ids of changed modules, which triggers incremental build. Null if build is not incremental */
readonly changedModules: null | Set
}
```