{"id":20717,"library":"webpack-bundle-tracker","title":"webpack-bundle-tracker","description":"Webpack plugin that outputs compilation statistics (status, chunks, assets) to a JSON file, primarily designed to integrate with django-webpack-loader for server-side rendering of webpack bundles in Django projects. Current stable version: 3.2.3 (released January 2025). Releases are synced with django-webpack-loader. Key differentiators: supports integrity hashes, relative paths, log timing, and compiles down to CJS for Node.js compatibility. Requires Node >=20.0.0. Provides TypeScript type definitions.","status":"active","version":"3.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/django-webpack/webpack-bundle-tracker","tags":["javascript","bundle","files","plugin","stats","webpack","typescript"],"install":[{"cmd":"npm install webpack-bundle-tracker","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-bundle-tracker","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-bundle-tracker","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin runs within webpack compilation lifecycle.","package":"webpack","optional":true}],"imports":[{"note":"Package is CJS-only; no ESM export. Use require().","wrong":"import BundleTracker from 'webpack-bundle-tracker';","symbol":"BundleTracker","correct":"const BundleTracker = require('webpack-bundle-tracker');"},{"note":"Export is default, not named. Destructuring will yield undefined.","wrong":"const { BundleTracker } = require('webpack-bundle-tracker');","symbol":"BundleTracker","correct":"const Plugin = require('webpack-bundle-tracker');"},{"note":"TypeScript users can import the type for options (path, filename, etc.).","wrong":"","symbol":"BundleTrackerOptions","correct":"import type { BundleTrackerOptions } from 'webpack-bundle-tracker';"}],"quickstart":{"code":"const path = require('path');\nconst BundleTracker = require('webpack-bundle-tracker');\n\nmodule.exports = {\n  context: __dirname,\n  entry: './src/index.js',\n  output: {\n    path: path.resolve('./dist'),\n    filename: '[name]-[contenthash].js',\n  },\n  plugins: [\n    new BundleTracker({\n      path: __dirname,\n      filename: 'webpack-stats.json',\n    }),\n  ],\n};","lang":"javascript","description":"Shows minimal webpack config using BundleTracker plugin to output stats JSON file."},"warnings":[{"fix":"Set environment variable NODE_OPTIONS=--openssl-legacy-provider before running webpack.","message":"Node.js >=17 with OpenSSL v3 breaks Webpack@4; set NODE_OPTIONS=--openssl-legacy-provider.","severity":"breaking","affected_versions":">=17.0.0"},{"fix":"Move subdirectory segments from 'filename' to 'path' option.","message":"Migrating from v1 to v2: 'path' option now used with 'filename' to generate output path; subdirectories in 'filename' no longer allowed.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"No action required; upgrade to v3.2.1+.","message":"lodash dependency removed in v3.2.1; no migration needed but ensure no reliance on internal lodash polyfills.","severity":"deprecated","affected_versions":">=3.2.1"},{"fix":"Upgrade to webpack 5 or use v2.x.","message":"Version 3.0.0 requires webpack 5 (publicPath: auto support removed for webpack 4).","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If other plugins depend on the stats file, adjust plugin order or use compiler hooks.","message":"The stats JSON is emitted on the 'emit' hook; ensure plugins order if using other emit plugins.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev webpack-bundle-tracker","cause":"Package not installed or dev dependency missing.","error":"Cannot find module 'webpack-bundle-tracker'"},{"fix":"Use: const BundleTracker = require('webpack-bundle-tracker');","cause":"Importing as named export instead of default.","error":"BundleTracker is not a constructor"},{"fix":"Ensure BundleTracker is in plugins array and webpack >=5 for v3.x.","cause":"Plugin instantiated outside webpack plugin array or webpack version incompatible.","error":"TypeError: Cannot read properties of undefined (reading 'compilation')"},{"fix":"Provide a valid path string: path: __dirname or path.resolve('./stats')","cause":"Missing or incorrect 'path' option in plugin constructor.","error":"The 'path' argument must be of type string. Received undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}