我有一些原始的 angular typescript 组件,我已将它们放入私有 NPM 模块中以在项目之间共享。
我像往常一样使用任何其他 npm 库导入我的组件,但是当我尝试为我的应用程序提供服务时,我得到了./node_modules/@bit/myusername.test.global.test-component/test.component.ts is missing from the TypeScript compilation.
我尝试在 tsconfig.json 中添加我node_modules/@bit/myusername.test.global.test-component/**/*.ts
的files
,但仍然得到同样的错误。
{
"compileOnSave": false,
"filesGlob": [
"**/*.ts", //Local source, this is the default //generated source
"node_modules/@bit/**/*.ts", // "./node_modules/justinyoung3231.test.global.test-component/*.ts" //generated source
],
//Add as many directories to the above list as needed
"compilerOptions": {
"baseUrl": "./src",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
这是package.json
我的私人模块中的
{
"_from": "@bit/myusername.test.global.test-component",
"_id": "@bit/myusername.test.global.test-component@1.0.1",
"_inBundle": false,
"_integrity": {{removed}},
"_location": "/@bit/myusername.test.global.test-component",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "@bit/myusername.test.global.test-component",
"name": "@bit/myusername.test.global.test-component",
"escapedName": "@bit%2fmyusername.test.global.test-component",
"scope": "@bit",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://node.bitsrc.io/myusername.test.global.test-component/-/myusername.test.global.test-component-1.0.1.tgz",
"_shasum": {{removed}},
"_spec": "@bit/myusername.test.global.test-component",
"_where": "/Users/HD/Desktop/_temp/booker",
"bundleDependencies": false,
"dependencies": {
"@angular/core": "~7.0.0"
},
"deprecated": false,
"devDependencies": {},
"homepage": "https://bitsrc.io/myusername/test/global/test-component",
"license": "SEE LICENSE IN LICENSE",
"main": "test.component.ts",
"name": "@bit/myusername.test.global.test-component",
"peerDependencies": {},
"version": "1.0.1"
}
如何在我的 tsconfig 中引用这些文件?