I use ts-morph to find all the source files:
the key code:
let tsmorph = require('ts-morph')
const project = new tsmorph.Project();
project.addSourceFilesAtPaths("../../tsconfig.json");
const sourceFiles = project.getSourceFiles();
console.log(sourceFiles) // there get empty array:[]
when I run npx ts-node test/unit/ts-morph-test.ts
: but there get empty array:[]
why it cannot get the correct results?
my code uploaded to codesandbox: https://codesandbox.io/s/2ntc8q
the test project code structure: you see it obviously has ts files.
from Why `project.addSourceFilesAtPaths("../../tsconfig.json");` cannot get the correct result source files?
No comments:
Post a Comment