Typedoc: Can't Exclude anything!?

Created on 17 Aug 2018  路  8Comments  路  Source: TypeStrong/typedoc

I've been trialing and erroring for hours and nothing I do will exclude the node_modules from the output. Specifically a package called @types/bluebird is causing errors with its index.d.ts.

typedoc version: 0.11.1
node version: 10.8.0
typescript version: 3.0.1

project structure is like so:

  • my_project
    -- src
    -- package.json
    -- docs
    -- tsconfig.json
    -- typedoc.json

I have a typedoc.json like below:

{
  "mode": "modules",
  "out": "docs",
  "exclude": "node_modules",
  "theme": "default",
  "ignoreCompilerErrors": true,
  "excludePrivate": true,
  "excludeNotExported": "true",
  "target": "ES6",
  "moduleResolution": "node",
  "preserveConstEnums": "true",
  "stripInternal": "true",
  "suppressExcessPropertyErrors": "true",
  "suppressImplicitAnyIndexErrors": "true",
  "module": "commonjs",
  "excludeExternals": true,
  "externalPattern": "node_modules",
  "includeDeclarations": false
}

then I run:
typedoc --json typedoc.json ./src
or
typedoc --json typedoc.json

No output is ever achieved because there is a ton of useless errors from the bluebird package. Nothing else is in the way of generating the docs as they worked fine up until something required the @types/bluebird.

Why does the excludes not work? I can't even get excludes to exclude my own files in my own project. Can't there be an option like excludeNodeModules: true so we don't have to worry about them at all.

bug

Most helpful comment

Anyone else with an issue like this?? Really frustrating and this is a totally breaking issue. Literally nothing about Typedocs works when @types/bluebird exists in node_modules. I even tried removing the problematic package, but then Typedocs fails because sequelize-typescript package will complain about missing dependencies. Why does Typedocs have to generate docs for node_modules?

All 8 comments

The exclude option is currently passed the absolute path to the file, so you need to specify **/node_modules as your exclude setting until that's fixed. I've been meaning to rework this for a while, and hopefully will finally get around to it tomorrow.

Looking into this some more while reworking that logic, I've found that you actually can't exclude a directory directly right now... You might need to have exclude set to **/node_modules/**.

I have tried **/node_modules/** and pretty much any other combination you could imagine. I even tried absolute path to the bluebird package. I'm pretty sure the excludes just doesn't do anything.

Anyone else with an issue like this?? Really frustrating and this is a totally breaking issue. Literally nothing about Typedocs works when @types/bluebird exists in node_modules. I even tried removing the problematic package, but then Typedocs fails because sequelize-typescript package will complain about missing dependencies. Why does Typedocs have to generate docs for node_modules?

I ran into this issue, and after troubleshooting, here's how I got past it:

  1. Remove any directories in node_modules/ and node_modules/@types which are not actively referenced in package.json. This is easy enough to have happen, especially when using git checkout. In my case, there were some old modules hanging around with unmet dependencies. Deleting those directories eliminated the problem.

  2. If you are using TypeScript >= 2.9, add "module": "es6", to your tsconfig.json's compilerOptions. In my case, I'm running typedoc as an npm script. When I updated angular, I also went from typescript 2.7 -> 2.9. This brought the new module import feature of 2.9 which was defaulting to module to none, causing the failure:

Cannot use imports, exports, or module augmentations when '--module' is 'none'.

Once I resolved both issues, everything worked again.

Same here, I've spent hours trouble shooting this, trying several different methods both with a typedoc.json file and via cli. Nothing is working for excluding files from the json export.

Hello, still running into the same problem, any updates?

Since it looks like #319 hasn't been linked yet, linking.

This is still a problem on master - resolving it adds some complexity that we still need to figure out how to resolve.

Was this page helpful?
0 / 5 - 0 ratings