简体   繁体   English

Typedoc使用require语法抛出错误

[英]Typedoc throws error with the require syntax

I am trying to generate documentation using typedoc. 我正在尝试使用typedoc生成文档。 I have the following lines in my typescript file. 我的打字稿文件中有以下几行。

var validator: any = require('validator');
import * as _ from 'lodash';
var mqtt: any = require('mqtt');
var fs = require('fs');
var path = require('path');
var tls = require('tls');
import * as collections from 'typescript-collections';

here, the require lines and lodash lines are throwing the following error. 这里,require行和lodash行抛出以下错误。

在此输入图像描述

Below is my config. 以下是我的配置。

gulp.task('typedoc',['clean-doc'], function () {
  return gulp
    .src(path.join(conf.paths.src, conf.path_pattern.ts))
    .pipe($.typedoc({
      module: tsConf.module,
      target: tsConf.target,
      includeDeclarations: false,

      out: conf.paths.docs,
      json: path.join(conf.paths.docs, conf.files.JSON_DOC),

      name: conf.files.PROJECT_NAME,
      ignoreCompilerErrors: true,
      excludeExternals:true,
      version: true

    }))
    .on('error', conf.errorHandler(conf.errors.title.TYPESCRIPT));
});

Why am I getting this error? 为什么我收到此错误? How can I get over this? 我怎么能克服这个? Please advice. 请指教。

Add global typings path(typings/index.d.ts) to the gulp task typedoc src. 将全局输入路径(typings / index.d.ts)添加到gulp任务typedoc src。

 return gulp
.src([["data/*.ts","typings/index.d.ts"])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM