/webpack-dep

Using webpack get dependencies and dependents.

Primary LanguageTypeScriptMIT LicenseMIT

npm version codecov

webpack-dep

Using webpack get dependencies.

Installation

npm:

npm install webpack-dep

Yarn:

yarn add webpack-dep

Usage

ESM:

import webpackDep from "webpack-dep";

const dependencyMap = await webpackDep({
  /*
  appDirectory: fs.realpathSync(process.cwd()),
  excludes: undefined, // using ana-loader default excludes
  webpackConfig: undefined, // using default webpack config
  errorCb: undefined, // no error callback
  */
});

console.log(dependencyMap);

API

webpackDep(options)

The webpackDep() function is used to get dependency map.

Parameters

  • options (Object) - The options object.
    • appDirectory (string) - The app directory path. Default: fs.realpathSync(process.cwd()).
    • excludes ((string | RegExp)[]) - Exclude finding dependencies in these conditions. Default: undefined using ana-loader default excludes.
    • webpackConfig ((config: Configuration) => Configuration) - A function receive the current webpack config and return the final webpack config. Default: undefined.
    • errorCb ((errors: StatsError[]) => void) - Error handler function. Default: undefined.