question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Files resolved via webpack configured modules are categorised as "undetermined"

See original GitHub issue

First 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:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
BernieSumptioncommented, Jul 11, 2018

Yup, working for me now 😃

0reactions
sverweijcommented, Jul 12, 2018

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entrypoint undefined, Content not from webpack. What wrong ...
I set entry point and output in webpack.config.js but I get some errors: i 「wds」: Project is running at http://localhost:9000/ i 「wds」: ...
Read more >
Writing a Plugin - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
How to Analyze Circular Dependencies in ES6? - Railsware
It is caused by circular dependencies that cannot be resolved synchronously by webpack. One is undefined, hence the error.
Read more >
How to quickly become a proficient Webpack configuration engineer ...
so to speak, configure entry , resolve , module , optimization , output , just let us use Webpack The packaging and build...
Read more >
Webpack aliases and relative paths
This is the resolve section of Webpack configuration and how it can ... node module, we need to reference it by relative path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found