A utility to parse JavaScript files, resolve dependencies using Node module resolution, and produce Closure Compiler chunk and file definitions based on dynamic import split points. Version 3.2.2 is the current stable release, with irregular releases. It differs from other bundlers by directly targeting Google Closure Compiler's chunk API, supporting Closure-Library style goog.provide/goog.require dependencies, and providing a visualization mode for dependency graphs. It outputs JSON for use with closure-compiler --chunk and --js flags.
npm install closure-calculate-chunksNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows building a chunk definition programmatically with all available options.
Upgrade to 3.2.2 and adjust code to expect the new JSON structure with 'chunk' array containing strings, not objects.
Update Node.js to 14 or later.
Use import syntax instead of require(). For CommonJS projects, use dynamic import() or migrate to ESM.
Use --extra-deps for individual namespaces instead of relying on base.js.
Use dynamic import('closure-calculate-chunks') or convert your project to ESM.Use: import calculateChunks from 'closure-calculate-chunks'
Update Node to >=14.0.0.