Rollup plugin (v1.2.0) that exports the bundle module tree as a JSON file for analysis or visualization. It provides per-file information including chunk name, entry/dynamic entry flags, asset detection, imports, and dynamic imports. The plugin is lightweight and has no dependencies beyond Rollup >=1.9.0. It is ideal for build pipeline introspection, dependency mapping, or custom tooling.
npm install rollup-plugin-extract-bundle-treeVerified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration using the plugin to export the bundle tree to bundle-tree.json.
When parsing output, check for the existence of `chunkName` before using it or rely on `isAsset` flag.
Treat `assetImports` as optional and default to an empty array if missing.
Upgrade Node.js to version 14 or higher.
Use import syntax or set type: 'module' in package.json, or use dynamic import().
Use import bundleTree from 'rollup-plugin-extract-bundle-tree'.
Install rollup: npm install --save-dev rollup.