list-broken-requires

lists broken require statements in a directory

Usage no npm install needed!

<script type="module">
  import listBrokenRequires from 'https://cdn.skypack.dev/list-broken-requires';
</script>

README

list-broken-requires

experimental

A command-line tool to find broken require and import paths in a source directory. For example, when you are requiring a file which has been moved or deleted.

For example, if you have a src folder with the following indx.js

// points to a file that does not exist
const a = require('./some/broken/path.js')

// also looks for ES6 imports
import './another/broken/path.js'

// a valid file
import './does-exist.js'

Now, we can run the tool on our src directory:

list-broken-requires src

Output:

/path/to/src/index.js
  './some/broken/path.js'  
  './another/broken/path.js'

Broken requires: 2

Install

npm install -g list-broken-requires

Usage

CLI

Usage:
  list-broken-requires [dir]

Where dir defaults to the current working directory.

See Also

License

MIT, see LICENSE.md for details.