'can't resolve module inside subdirectory typescript

The module arrayGenerator.ts lies inside a subfolder, it works fine for other modules(Array.ts) inside the parent folder. But when I add a new module Sorting.ts, it gives me can't resolve the error. There is inconsistency regarding the compilation. no Array.js in dist but it was working.. path is like this. and below is my tsconfig.json. I tried some configurations like change "src" to "src/**/*", but all don't work or the compiler turned down the changes.

dir
 - slices
  - dist 
  - Array.ts
  - Sorting.ts
  - bricks
    - arrayGenerator.ts

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "react-jsx",
    "noEmit": true
  },
  "include": [
    "src"
  ]
}


Solution 1:[1]

The issue disappeared after I transferred code to a new template.

Solution 2:[2]

I had a similar issue, and it went away after re-saving the files that caused errors. The problem is very reproducible when moving or renaming files. Seems like Webpack is not updating its cache.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MISO
Solution 2 alekop