Webpack Dep Finder
A fast and efficient tool for pinpointing the issuer path of a specific dependency in your Webpack bundles.
Example Output
Found target dependency: /path/to/your/dependency.js
/path/to/your/entry-file.js
/path/to/another/dependency.js
/path/to/your/dependency.js
This output shows the path from the entry file to the target dependency.
Usage
As a CLI Utility
You can use webpack-dep-finder
as a CLI tool:
npm install -g webpack-dep-finder
npx webpack-dep-finder --dependency-pattern /your-regex-pattern/ --config path/to/webpack.config.js
CLI Options
-d, --dependency-pattern <pattern> Regex pattern to match the resource path/filename to locate. (Required)
-b, --bail Stop searching as soon as the dependency is found. (Default: true)
-c, --config <path> Path to the Webpack configuration file. (Default: "webpack.config.js")
-V, --version Output the version number.
-h, --help Output usage information.
As a Webpack Plugin
npm install --save-dev webpack-dep-finder
yarn add -D webpack-dep-finder
const WebpackDepFinder = require("webpack-dep-finder");
new WebpackDepFinder({
dependencyPattern: /your-regex-pattern/,
bail: true
});
Performance Insights
Speed Benefits:
- Up to 100x Faster: Unlike tools that analyze the entire Webpack build,
webpack-dep-finder
identifies dependencies quickly by stopping the search as soon as the specified dependency is found. - Conditional Timing: If the dependency is not found, the tool will run for the entire build duration. The effectiveness can vary based on your project’s size and structure.
Visualizing Speedup:
Major Use Cases
- Optimizing Script Evaluation Time: Speed up the process of finding and analyzing dependencies, crucial for large React web applications.
- Reducing Bundle Chunk Size: Efficiently locate and manage dependencies to optimize bundle sizes and overall performance.
Troubleshooting
Why is webpack-dep-finder
so fast?
webpack-dep-finder
is designed for speed by stopping the search as soon as the specified dependency is found during the Webpack compilation process. This approach contrasts with tools that analyze the entire bundle, making webpack-dep-finder
a quicker option for targeted searches.
What happens if the dependency is not found?
If the specified dependency isn't found, webpack-dep-finder
will complete the entire build process without performing any additional analysis. Ensure that the dependency name is correct and that it is included in your Webpack build.
Other Tools
- Statoscope - A more comprehensive Webpack bundle analysis tool with additional features like interactive treemaps.
Maintainers
Support the developer!
Contributing
We welcome contributions to Webpack Dep Finder! Please see CONTRIBUTING.md for more details.