Webpack Dep Finder
Fast and efficient tool for finding the issuer path to a specific dependency in your Webpack bundles.
Install
npm install --save-dev webpack-dep-finder
yarn add -D webpack-dep-finder
Usage (as a plugin)
new WebpackDepFinder({
dependencyPattern: /your-regex-pattern/,
bail: true
});
This module will help you:
- Quickly locate the issuer path of a specific dependency within your Webpack bundles.
- Save time by bailing as soon as the dependency is found, making it significantly faster than traditional methods.
- Integrate seamlessly into your existing Webpack setup.
Options (for plugin)
new WebpackDepFinder(options?: object)
Name | Type | Description |
---|
dependency | {RegExp} | Required. The regex pattern to match the resource path/filename of the dependency you want to locate in your bundles.. |
bail | {Boolean} | Default: true . Determines if the search should stop as soon as the dependency is found. |
Usage (as a CLI utility)
You can also use webpack-dep-finder
as a CLI tool if you install it globally
webpack-dep-finder --dependency-pattern /your-regex-pattern/
Example Output
The command will output the dependency path:
Found target dependency: /home/van/Pgammin/webpack-dep-finder/src/deps/c.js
/home/van/Pgammin/webpack-dep-finder/src/index.js
/home/van/Pgammin/webpack-dep-finder/src/deps/a.js
/home/van/Pgammin/webpack-dep-finder/src/deps/b.js
/home/van/Pgammin/webpack-dep-finder/src/deps/c.js
This shows the path from the entry file to the target dependency.
Options (for CLI)
-d, --dependency-pattern <pattern> Regex pattern to match the resource path/filename to locate. (Required)
Arguments are documented below:
bundleStatsFile
Path to the Webpack stats JSON file.
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)
-V, --version Output the version number.
-h, --help Output usage information.
Troubleshooting
Why is webpack-dep-finder
so fast?
webpack-dep-finder
is designed to be extremely fast by stopping the search as soon as the specified dependency is located during the Webpack compilation process. This contrasts with other tools that might analyze the entire bundle, making dep-finder
a much quicker option for targeted searches.
What happens if the dependency is not found?
If the specified dependency is not found, webpack-dep-finder will simply 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
Contributing
We welcome contributions to Webpack Dep Finder! Please see CONTRIBUTING.md for more details.
Check out CONTRIBUTING.md for instructions on contributing 🎉