@magic-spells/rollup-plugin-skip-unchanged-output
v1.0.0
Published
A Rollup plugin that skips writing files when their content hasn't changed, preventing unnecessary file system operations
Maintainers
Readme
@magic-spells/rollup-plugin-skip-unchanged-output
A Rollup plugin that skips writing files when their content hasn't changed, preventing unnecessary file system operations and reducing build noise.
Installation
npm install @magic-spells/rollup-plugin-skip-unchanged-output --save-devUsage
import skipUnchangedOutput from '@magic-spells/rollup-plugin-skip-unchanged-output';
export default {
// ... your rollup config
plugins: [
// ... other plugins
skipUnchangedOutput({
logWhenSkipped: false, // default: false
logWhenChanged: true // default: true
})
]
};Options
logWhenSkipped(boolean): Whether to log when files are skipped due to unchanged content. Default:falselogWhenChanged(boolean): Whether to log when files are written due to changed content. Default:true
How it works
The plugin maintains an in-memory cache of file contents. During the generateBundle phase, it compares the current content with the cached version. If the content is identical, the file is removed from the bundle, preventing unnecessary writes to the file system.
This is particularly useful when:
- Working with file watchers that trigger on any file change
- Preventing rate limiting issues with external services (like Shopify CLI)
- Reducing unnecessary I/O operations during development
License
MIT
