question: how to let Angular look inside the node_modules
folder instead of the 'custom directory defined in package.json' when including files from a custom npm-module. (see package.json below)
In my project i have 2 folders
- root
- angular
- src
- package.json
- shared (npm module)
- src
- package.json
- angular
within the directory of angular, i install my custom npm module through the normal npm install
. here is the package.json file
{
"name": "angular",
"dependencies": {
"shared-module": "file:../shared-module"
}
i can see its installed correctly by checking the node_modules folder of the angular directory
- root
- angular
- node_modules
- shared-module
- src
- shared-module
- node_modules
- angular
then when I include a file from the shared-module in the angular project
import 'shared-module/src/util/countries';
it doesn't seem to look inside the angular->node_modules folder, but instead keeps going to the 'original' directory of the custom npm module ..
ERROR in ../shared-module/src/util/countries.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
if I update the tsconfig.json to include the 'original' directory, it works..
"include": [
"./src/**/*.ts",
"../shared-modules//src/**/*.ts"
]
But then there is no real point adding it to the package.json with (unless you publish the module)
"shared-module": "file:../shared-module"
So it feels like I am missing some settings maybe? Thanks in advance
edit: it seems NPM 5 creates a symlink when using it like this
"shared-modules": "file:../shared-module"
edit2: preserveSymlinks doesn't seem to do anything (https://www.typescriptlang.org/docs/handbook/compiler-options.html)
anyway around that behavior and just really install the package?