Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getModuleSpecifierSourceFile return undefined for import with #1508

Open
teyma opened this issue Feb 27, 2024 · 0 comments
Open

getModuleSpecifierSourceFile return undefined for import with #1508

teyma opened this issue Feb 27, 2024 · 0 comments

Comments

@teyma
Copy link

teyma commented Feb 27, 2024

Hi, I'm working on project that verify the architecture of other projects.
I'm using ts-morph to read files and get imports from them.

Everything works fine expect for some imports that could not be found.

I'm using the method getModuleSpecifierSourceFile that returns undefined.

This is an example of an import that does not work.

import * as path from 'path';

This is how i initialize the project

const project = new Project({
   tsConfigFilePath: 'tsconfig.json',
});

project.addSourceFilesAtPaths('src/**/*.ts');

In the compiler options in my tsconfig, I'm using :

"module": "commonjs"

I tried to add "moduleResolution": "Node", but it didn't change anything.

Thanks in advance for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant