Utility for caching compiled JavaScript modules (e.g., JSX) to speed up subsequent requires in Node.js environments. Version 4.4.0 is the stable release. It wraps `require.extensions` to intercept module compilation, caching results based on file path and modification time. Different from generic require-hook libraries because it integrates with Hadron's home directory settings and is optimized for MongoDB Compass usage. Release cadence is tied to Compass releases; updates are infrequent but breaking changes are possible with major version bumps.
npm install hadron-compile-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up compile cache with a custom home directory and demonstrates requiring a JSX file.
Call CompileCache.setHomeDirectory(home) at application startup before requiring any files to be cached.
Use CommonJS require() instead of ESM import.
N/A
Use const CompileCache = require('hadron-compile-cache');Ensure the home directory exists and the process has write permissions.