The `rollup-plugin-app-utils` package provides a collection of common build utilities designed for Rollup-based projects. Currently stable at version 1.0.6, it does not specify a strict release cadence but appears to be a mature 1.x release. Its core functionalities include an i18n bundler capable of synchronizing translation keys across multiple locale files using a 'back-filling' mechanism, asset copying, dynamic directory preparation and cleanup, and HTML content injection. A key differentiator is its consolidation of these diverse utilities under a single plugin, with the i18n bundler offering intelligent key management. Developers should be aware that several of its file system operations, such as `copyAssets` and `emptyDirectories`, are synchronous, which can impact build performance on very large projects. The plugin is primarily consumed in `rollup.config.js` files, typically within an ESM context.
npm install rollup-plugin-app-utilsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `rollup-plugin-app-utils` in a `rollup.config.js` to use `emptyDirectories` for cleanup and `i18nBundler` for processing and back-filling internationalization strings. It sets up mock locale files to showcase the automatic synchronization of translation keys across languages.
For larger projects, monitor build times and consider the potential performance impact. If synchronous blocking becomes an issue, explore alternative build steps or custom plugins that utilize asynchronous file operations for performance-critical tasks, or consider running these steps in a separate, non-blocking process if feasible.
Ensure you understand the implications of `skipBackFilling`. If you need automatic key and file synchronization (adding missing keys/files, removing orphaned keys/files), leave this option as `false` (its default behavior). If you manage translations manually and explicitly want to disable this feature, set it to `true` and implement your own external synchronization strategy.
Always use `import translations from 'i18n.translations'` in your application code to access the bundled translations. Ensure the `i18nBundler` plugin is correctly configured and active within your Rollup setup's `plugins` array to handle this virtual module resolution.
Ensure `Utils.i18nBundler({...})` is correctly included in your `rollup.config.js` `plugins` array. It is often beneficial to place the `i18nBundler` near the beginning of the `plugins` list to ensure its virtual module is resolved before other resolution plugins interfere.Verify that the user account running the Rollup build has appropriate read and write permissions for all directories and files involved in the copy, empty, and prepare operations. On Linux/macOS, check file system permissions using `ls -l` and adjust with `chmod` if needed. On Windows, verify folder security settings.