Sep 3, 2018 · 2 min read
I want to thank you for sharing this with the community.
Unfortunately doesn’t work for me. When I want to import objects from node_module libraries or even my domain classes.
This is my tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"moduleResolution": "node",
"lib": [
"dom",
"es2015.promise",
"es2017"
],
"baseUrl": ".",
"paths": {
"~/*": [
"app/*"
],
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
},
"include": [
"app/**/*.ts",
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"exclude": [
// "node_modules",
"platforms"
]
}And this is my package.json:
{
"nativescript": {
"id": "org.nativescript.testproject",
"tns-ios": {
"version": "4.2.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@angular/animations": "~6.1.0",
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"@types/node": "^10.1.4",
"nativescript-angular": "~6.1.0",
"nativescript-checkbox": "^3.0.3",
"nativescript-iqkeyboardmanager": "^1.3.0",
"nativescript-ng2-carousel-swipeable": "^0.1.2",
"nativescript-snackbar": "^3.1.0",
"nativescript-theme-core": "~1.0.4",
"nativescript-unit-test-runner": "^0.3.4",
"reflect-metadata": "~0.1.8",
"rxjs": "^6.2.2",
"rxjs-compat": "^6.2.2",
"tns-core-modules": "^4.2.0",
"ts-node": "^7.0.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0",
"@ngtools/webpack": "~6.1.0",
"@types/chai": "^4.1.4",
"@types/mocha": "^5.2.5",
"chai": "^4.1.2",
"karma": "3.0.0",
"karma-chai": "0.1.0",
"karma-mocha": "1.3.0",
"karma-nativescript-launcher": "0.4.0",
"mocha": "^5.2.0",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "^0.15.1",
"ts-mockito": "^2.3.1",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "~2.7.2"
},
"readme": "NativeScript Application",
"scripts": {
"test": "mocha -r ts-node/register app/tests/*spec.ts"
}
}Adding node_modules in includes and commented out in exclude doesn’t make any difference I’m getting:
Error: Cannot find module ‘tns-core-modules/application’ same goes for my components.
I’d really appreciate any leads.
Thanks in advance!
