I've taken some raw angular typescript components and packaged them into a private NPM module for sharing between various projects.
Although I import these components like any other npm library, I encounter an error message when trying to serve my application:
./node_modules/@bit/myusername.test.global.test-component/test.component.ts is missing from the TypeScript compilation.
My attempt to resolve this by adding
node_modules/@bit/myusername.test.global.test-component/**/*.ts
to the files
section in tsconfig.json failed to eliminate the error.
{
"compileOnSave": false,
"filesGlob": [
"**/*.ts", //Default local source
"node_modules/@bit/**/*.ts", //Generated sources
],
//Add additional directories as necessary
"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"
]
}
}
Below is the content of the package.json
file residing in my private module:
{
"_from": "@bit/myusername.test.global.test-component",
"_id": "@bit/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb2a6aaacbaadb1beb2baf1abbaacabf1b8b3b0bdbeb3f1abbaacabf2bcb0b2afb0b1bab1ab9feef1eff1ee">[email protected]</a>",
"_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"
}
How can I properly reference these files in my tsconfig?