Using webpack get dependencies.
npm:
npm install webpack-dep
Yarn:
yarn add webpack-dep
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);
The webpackDep()
function is used to get dependency map.
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 defaultexcludes
.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
.