{"id":16666875,"url":"https://github.com/smelukov/bundle-internals","last_synced_at":"2025-07-14T10:36:13.627Z","repository":{"id":35045166,"uuid":"200231221","full_name":"smelukov/bundle-internals","owner":"smelukov","description":"The webpack plugin that collects a debug information about your webpack bundle (e.g. bundled modules, input entry points, and output assets)","archived":false,"fork":false,"pushed_at":"2022-02-12T11:05:17.000Z","size":73,"stargazers_count":13,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T03:42:08.641Z","etag":null,"topics":["analyzer","bundle","bundler","internals","js","webpack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smelukov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-02T12:31:08.000Z","updated_at":"2022-07-13T18:24:16.000Z","dependencies_parsed_at":"2022-08-08T04:01:23.810Z","dependency_job_id":null,"html_url":"https://github.com/smelukov/bundle-internals","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/smelukov/bundle-internals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smelukov%2Fbundle-internals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smelukov%2Fbundle-internals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smelukov%2Fbundle-internals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smelukov%2Fbundle-internals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smelukov","download_url":"https://codeload.github.com/smelukov/bundle-internals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smelukov%2Fbundle-internals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261386809,"owners_count":23150873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzer","bundle","bundler","internals","js","webpack"],"created_at":"2024-10-12T11:12:17.894Z","updated_at":"2025-06-23T00:06:37.747Z","avatar_url":"https://github.com/smelukov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bundle Internals Plugin\n\nThe webpack plugin that collects a debug information about your webpack bundle (e.g. bundled modules, input entry points, and output assets)\n\n[![npm](https://img.shields.io/npm/v/bundle-internals)](https://www.npmjs.com/package/bundle-internals)\n\n## Usage\n\n`npm i bundle-internals`\n\n```js\nconst BundleInternalsPlugin = require('bundle-internals');\n\nconfig.plugins.push(new BundleInternalsPlugin());\n```\n\n## Options\n\n### saveTo: string\n\nAllow to dump a debug data to specified file (relative an output directory)\n\n```js\nnew BundleInternalsPlugin({\n    saveTo: 'debug.json'\n});\n```\n\n### runMode: string\n\nOne of the values:\n\n- `all` - run plugin on watch and non-watch build\n- `non-watch` - run plugin only on non-watch build\n- `watch` - run plugin only on watch build\n\n`runMode` is `all` by default\n\n```js\nnew BundleInternalsPlugin({\n    runMode: 'watch'\n});\n```\n\n### resolve: boolean\n\nResolves payload before pass it to the data-hook\n\n```js\nnew BundleInternalsPlugin({\n    resolve: true\n});\n```\n\n`resolve` is `false` by default\n\n\u003e Don't mix `resolve` and `saveTo` options because `resolve` makes a recursive JSON that can't be stringified\n\u003e If you really want to save recursive JSON then use some specialized tools (e.g. [flatted](https://www.npmjs.com/package/flatted))\n\n## Hooks\n\n### data(payload)\n\n```js\nconst bundleInternalsPlugin = new BundleInternalsPlugin()\nbundleInternalsPlugin.hooks.data.tap('my-plugin', payload =\u003e {\n    console.log(payload);\n})\n```\n\n## Data format\n\nData format described in [types.d.ts](src/types.d.ts)\n\n### Data denormalization/resolving\n\nSome data fields contain only ids and need to denormalize/resolve. For example `file` field in `data.input.modules` contain the only id of the file and we need to resolve it from `data.input.files`:\n\n```js\ndata.input.modules.forEach(module =\u003e {\n    module.file = data.input.files.find(file =\u003e module.file === file.path)\n});\n```\n\nOr you can use builtin `resolve` function:\n\n```js\nconst BundleInternalsPlugin = require('bundle-internals');\n\nconst bundleInternalsPlugin = new BundleInternalsPlugin()\nbundleInternalsPlugin.hooks.data.tap('my-plugin', payload =\u003e {\n    BundleInternalsPlugin.resolve(payload);\n    console.log(payload);\n});\n```\n\nOr use `resolve` option:\n\n```js\nnew BundleInternalsPlugin({\n    resolve: true\n});\n```\n\n## Why not a builtin webpack Stats object?\n\nIts too huge to analyze ;)\n\n## Data Analyzing\n\nThis plugin will be used in [Webpack Runtime Analyzer](https://github.com/smelukov/webpack-runtime-analyzer/) V2\n\nBut for now, you can get the raw bundle internal data and analyze it manually.\n\n\u003e It's just a JSON and you may use any tools to analyze and visualize it\n\nFor example, you may load it to [Jora Sandbox](https://discoveryjs.github.io/jora-sandbox/) and make some interesting queries to it.\n\nJora Sandbox is a sandbox for the [Jora](https://github.com/discoveryjs/jora) query engine that allows you to query and aggregate any data from JSON.\n\nFor example...\n\n### Used node modules\n\nJora Query:\n\n```\ninput.files.nodeModule\n  .group(\u003cname\u003e)\n  .({name: key, version: value.version.sort()})\n  .sort(\u003cname\u003e)\n```\n\nResult:\n\n```js\n[\n  { name: \"@babel/polyfill\", version: [\"7.4.4\"] },\n  { name: \"@babel/runtime\", version: [\"7.5.5\"] },\n  { name: \"@firebase/app\", version: [\"0.1.10\"] },\n  { name: \"@firebase/messaging\", version: [\"0.1.9\"] },\n  { name: \"@firebase/util\", version: [\"0.1.10\", \"0.1.8\"] },\n  { name: \"@sentry/browser\", version: [\"4.6.6\"] },\n  // ...\n]\n```\n\n### The most required modules\n\nJora Query:\n\n```\ninput.modules.sort(reasons.size() desc).id\n```\n\nResult:\n\n```js\n[\n  \"./node_modules/react/index.js\",\n  \"./node_modules/prop-types/index.js\",\n  \"./node_modules/react-redux/lib/index.js\",\n  \"./node_modules/lodash/get.js\",\n  \"./node_modules/@babel/polyfill/node_modules/core-js/modules/  _export.js\",\n  \"./node_modules/react-dom/index.js\",\n  // ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmelukov%2Fbundle-internals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmelukov%2Fbundle-internals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmelukov%2Fbundle-internals/lists"}