npm dependency-cruiser 4.1.0
web packing (v4.1.0)

latest releases: 16.6.0, 16.6.0-beta-1, 16.5.0...
6 years ago
  • 🐣 adds support for webpack config resolve support (a.o. alias and modules)
    • on the command line with --webpack-config
    • in the .dependency-cruiser.json in a webpackConfig key
    • in the API as a pResolveOptions parameter
  • 🔧 updates several dependencies and development dependencies to latest
  • 🔧 removed some files from the npm distribution that weren't necessary on runtime
  • 🔧 some internal refactoring to help readability

Webpack config resolve support

Scope

See the FAQ

command line

When you add --webpack-config as a command line option dependency-cruiser will attempt to read the webpack config file passed as argument (or webpack.config.js in the current working directory if none was passed) and read any resolve configuration from it.

The latest fashion in webpack configs is to have it return a function that takes up two two parameters (env and arguments). If you need those, you can specify them in .dependency-cruiser.json

in .dependency-cruiser.json

In the options section you can put a webpackConfig section that allows for specifying (1) the config file name (2) any environment parameters (3) any other (webpack) command line arguments that might be of interest (all optional). E.g.

...
  "options":  {
    "webpackConfig": {
      "fileName": "webpack.config.js",
      "env": { "production": true },
      "arguments": { "mode": "production" }
    }
  }
...

or

...
  "options":  {
    "webpackConfig": {
      "fileName": "webpack.config.js",
      "env": "production",
      "arguments": { "mode": "production" }
    }
  }
...

in the API

The cruise API grew an extra pResolveOptions parameter that takes a webpack enhanced-resolve resolve key,

Some notes on use

  • If you normally use environment variables to run webpack (e.g. NODE_ENV=production webpack) you probably should on dependency-cruiser as well if that makes a difference in the resolve section of your config.
  • if you normally pass options and parameters to webpack, you probably should pass these on dependendency-cruiser as well - again if that makes a difference on how the resolve key looks. At the moment it's only possible to pass them in the .dependency-cruiser.json
    • If you normally pass things like --env.prod or --env prod you'll have to translate as specified in (see environment-options) and put it in .dependency-cruiser.json's webpackConfig section (example below)
    • If you have other parameters that might influence how the resolve key looks, you'll have to pass them in the same manner.

Don't miss a new dependency-cruiser release

NewReleases is sending notifications on new releases.