docgeni / docgeni

📖 A modern, powerful and out of the box documentation generator for Angular components lib and markdown docs.(现代化的、强大的、开箱即用的 Angular 组件文档生成工具)

Home Page:https://docgeni.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docgeni serve 异常

HyperLife1119 opened this issue · comments

在组件目录下添加 schematics/ng-add/index.ts 文件,执行 docgeni serve 会抛异常。

最小复现:https://github.com/HyperLife1119/docgeni-demo/tree/bug/schematics

文件内容:

import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';

export function ngAdd(): Rule {
  return (tree: Tree, context: SchematicContext) => {
    context.addTask(new NodePackageInstallTask());
    return tree;
  };
}

异常:

> docgeni serve --port 4600

⠋ 
Start building...can't resolve node:assert
can't resolve node:assert
Error: Debug Failure. False expression.
    at resolveModuleNamesReusingOldState (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:119850:26)
    at processImportedModules (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121296:35)
    at findSourceFileWorker (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121076:17)
    at findSourceFile (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120922:26)
    at /Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120871:85
    at getSourceFileFromReferenceWorker (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120837:34)
    at processSourceFile (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120871:13)
    at /Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121175:17
    at Object.forEach (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:181:30)
ℹ Error: Debug Failure. False expression.
    at resolveModuleNamesReusingOldState (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:119850:26)
    at processImportedModules (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121296:35)
    at findSourceFileWorker (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121076:17)
    at findSourceFile (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120922:26)
    at /Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120871:85
    at getSourceFileFromReferenceWorker (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120837:34)
    at processSourceFile (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:120871:13)
    at /Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121175:17
    at Object.forEach (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:181:30)
    at processReferencedFiles (/Users/hyperlife1119/Public/workspace/github/test-workspace/node_modules/typescript/lib/typescript.js:121174:16)

因为自动生成API读取Node.js模块会有问题,通过在 tsconfig.json 排除 schematics 目录解决。