glob implementation should not ignore node_modules

This issue has been tracked since 2023-01-27.

Search terms

node_modules glob

Expected Behavior

I expected to be able to use an entry point located within a node_modules folder using the packages strategy, as suggested in this comment by @Gerrit0.

Actual Behavior

If TypeDoc's glob implementation encounters a node_modules dir anywhere within a path, it is explicitly ignored.

Steps to reproduce the bug

  1. Create a typedoc.json with an entry point in node_modules
  2. Run typedoc
  3. Failure: no entry points found


  1. Create a typedoc.json with an entry point in node_modules and another (known good entry point) not in a node_modules
  2. Run typedoc
  3. Notice that the entry point in node_modules is excluded from the build


  • Typedoc version: v0.23.24
  • TypeScript version: v4.7.4 / v4.9.4
  • Node.js version: v18.x
  • OS: macOS

A potential fix is to remove the explicit check for node_modules from the glob implementation. As it's unclear to me why it's present, this may have unintended consequences. Removing it does not fail the test suite. Another route would be to support an ignoreNodeModules option for glob -- defaulting to true -- and be set to false when computing entry points.

My workaround right now is a monkeypatch which bypasses Node's subpath exports restrictions:

import {sync as glob} from 'glob';

)).glob = glob;
boneskull wrote this answer on 2023-02-02

(would send PR if this is a real bug; it seems like @Gerrit0 thinks it should work, unless I'm misunderstanding)

Gerrit0 wrote this answer on 2023-02-02

As it's unclear to me why it's present

If I recall correctly, because people were specifying inputs like **/*.ts, which required traversing >100k files in node_modules, and they didn't actually mean to include that. On a slow disk, this was making the build take far longer than it should. I'd have to go back in history quite a while to find it, was at least a couple years ago.

If there's a smart way to ignore node_modules unless explicitly listed in the path, I think that'd be ideal... but it's probably okay to get rid of that exclude.

More Details About Repo
Owner Name TypeStrong
Repo Name typedoc
Full Name TypeStrong/typedoc
Language TypeScript
Created Date 2014-05-24
Updated Date 2023-03-19
Star Count 6487
Watcher Count 68
Fork Count 639
Issue Count 48


Issue Title Created Date Updated Date