main.tns.ts is missing from the TypeScript compilation. Migration from Angular to Nativescript

Viewed 426

Thanks in advance for looking at the question.

I started a migration from Angular to NativeScript... When I run tns run android --bundle I get the following error:

ERROR in ./src/main.tns.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: ..../src/main.tns.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at ..../node_modules/@ngtools/webpack/src/ivy/loader.js:59:26
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

In tsconfig.tns.json file:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "baseUrl": "./",
    "paths": {
      "@src/*": [
        "src/*.tns.ts",
        "src/*.ts"
      ]
    }
  },
  "files": [
    "src/main.tns.ts"
  ]
}

I realize this question is similar to others. However, I've tried the common suggestions to no avail.

1 Answers

Was the case for me, so maybe is for others: if your path contains hard links / junctions, try opening the project using the "clean" path, avoiding any links.

Related