fix: dep paths for windows
This commit is contained in:
@@ -41,21 +41,24 @@ const getImports = (fileCode, itemPath) => {
|
||||
|
||||
const getDependencies = (entryPoint, projectDir, webpackConfigPath) => {
|
||||
const rootPath = path.resolve();
|
||||
const separator = path.sep;
|
||||
|
||||
return madge(entryPoint, {
|
||||
webpackConfig: webpackConfigPath,
|
||||
baseDir: projectDir,
|
||||
// TODO: this filter will be extended based on how much dependencies is needed
|
||||
dependencyFilter: (depPath, sourcePath) => sourcePath === `${rootPath}/${entryPoint}`
|
||||
dependencyFilter: (depPath, sourcePath) => sourcePath === `${rootPath}${separator}${entryPoint}`
|
||||
})
|
||||
.then(res => res.obj())
|
||||
.then(obj =>
|
||||
Object.entries(obj).reduce((tree, [key, value]) => {
|
||||
const moduleName = `${projectDir}/${key}`;
|
||||
const moduleName = `${projectDir}${separator}${key.replace(/\//g, separator)}`;
|
||||
|
||||
tree[moduleName] = {
|
||||
moduleName,
|
||||
importedModuleNames: value.map(v => `${projectDir}/${v}`)
|
||||
importedModuleNames: value.map(
|
||||
v => `${projectDir}${separator}${v.replace(/\//g, separator)}`
|
||||
)
|
||||
};
|
||||
|
||||
return tree;
|
||||
|
||||
Reference in New Issue
Block a user