我遇到了 TS 问题,其中 tsc 编译器没有拾取我的 lib 目录中的所有 .ts/.js 文件。这是一个非常简单的问题,不知道为什么会这样。tsc 只收集了大约 20% 的文件总数。有人知道为什么它不会在我的 lib 目录中提取所有这些吗?
我尝试了“经典”和“节点” moduleResolution
,同样的问题。
我有这个 tsconfig.json 文件:
{
"compilerOptions": {
"outFile": "dist/suman.js",
"declaration": true,
"baseUrl": ".",
"paths": {
},
"types": [
"node",
"async",
"lodash"
],
"typeRoots": [
"node_modules/@types"
],
"target": "es5",
"module": "system",
"moduleResolution": "classic",
"noImplicitAny": true,
"removeComments": true,
"allowUnreachableCode": true,
"lib": [
"es2015",
"es2016",
"es2017",
"dom"
]
},
"allowJs": true,
"compileOnSave": false,
"include": [
"lib/**/*"
],
"exclude": [
"test",
"node_modules",
"dist"
]
}
使用此命令:
tsc --project tsconfig.json
我有以下输出
dist/suman.js
这是输出:
System.register("freeze-existing", [], function (exports_1, context_1) {
'use strict';
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
}
};
});
// ..... more files...more files...
System.register("test-suite-methods/make-it", [], function (exports_12, context_12) {
'use strict';
var __moduleName = context_12 && context_12.id;
function handleBadOptions(opts) {
}
var domain, util, pragmatik, _, async, colors, rules, constants, incr, handleSetupComplete;
return {
setters: [],
execute: function () {
domain = require('domain');
util = require('util');
pragmatik = require('pragmatik');
_ = require('underscore');
async = require('async');
colors = require('colors/safe');
rules = require('../helpers/handle-varargs');
constants = require('../../config/suman-constants');
incr = require('../incrementer');
handleSetupComplete = require('../handle-setup-complete');
}
};
});