Files resolved via webpack configured modules are categorised as "undetermined"
See original GitHub issueFirst off, thanks for the excellent work on this project. I’ve been waiting for #4 to be merged so I can use it in a webpack project, and it’s working very nicely. I’ve found one issue with the new webpack resolution.
Expected behaviour
When a file contains an import from e.g. “shared/foo” which webpack resolves to a file in the local source tree (say ./src/shared/foo.ts), then dependency cruiser should classify the dependency as “local”.
Current Behavior
The dependency is correctly mapped - the source and destination files paths are correctly resolved - but the dependency is classified as “undetermined”.
Steps to Reproduce (for bugs)
Key files excerpted below, hopefully this is enough detail but let me know if you’d like me to make a working minimal repro.
src/A.ts:
import foo from "shared/B"
src/shared/B.ts
export default function X() {}
webpack.config.js
module.exports = {
context: path.resolve(__dirname, "src"),
resolve: {
// treat all folders in src as modules
modules: [path.resolve(__dirname, "src"), "node_modules"],
extensions: [".ts", ".tsx", ".js", ".json"]
}
}
.dependency-cruiser.json
// in "rules"
{
"name": "no-undetermined",
"severity": "error",
"comment": "Don't allow undetermined dependencies",
"from": {
"path": ".*"
},
"to": {
"dependencyTypes": ["undetermined"]
}
}
CLI output
depcruise --validate .dependency-cruiser.json src/A.ts
error no-undetermined: src/A.ts → src/screens/B.ts
Context
Your Environment
- Version used: 4.1.1
- Node version: v8.11.2
- Operating System and version: Mac OS 10.13.5
- Link to your project: private, but can provide a public minimal reproduction if required
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Yup, working for me now 😃
@BernieSumption the PR is merged to the main branch and published as a regular release (v4.3.0). Thanks again for filing the issue and helping with the validation!