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

Dynamic Imports are not handled #129

Closed
bennycode opened this issue Feb 8, 2025 · 0 comments · Fixed by #130
Closed

Dynamic Imports are not handled #129

bennycode opened this issue Feb 8, 2025 · 0 comments · Fixed by #130

Comments

@bennycode
Copy link
Owner

bennycode commented Feb 8, 2025

I tested the following code in the TypeScript AST Viewer:

const module = await import('./my-function.function'); 

It shows that this call expression is of type SyntaxKind.ImportKeyword, which isn't currently handled in convertFile.

This snippet could help detect it:

const initializer = declaration.getInitializerIfKind(SyntaxKind.AwaitExpression);
const callExpression = initializer?.getExpressionIfKind(SyntaxKind.CallExpression);
const importExpression = callExpression?.getExpressionIfKind(SyntaxKind.ImportKeyword);

Expected output:

const module = await import('./my-function.function.js'); 
@bennycode bennycode changed the title Dynamic Imports Are Not Converted Dynamic Imports are not handled Feb 8, 2025
@bennycode bennycode linked a pull request Feb 21, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant