imports not working in typescript project
See original GitHub issue/file_a.ts
export async function test() {
console.log('test');
}
/file_b.ts
import { test } from './file_a.ts';
export async function handler(event: LambdaEvent): Promise<LambdaResponse> {
await test();
}
Executing the handler of file_b (using sls offline or deploying to aws) leads to something like:
TypeError: file_a_1.test is not a function
Both eslint and typescript are not showing any errors. The code is compiling fine. I assume it has something to do with webpack or babel.
That is the issue I am facing right now in a nutshell. I will try to create a small repo to reproduce this error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:32 (14 by maintainers)
Top Results From Across the Web
Import statement does not work in typescript - Stack Overflow
Then I'm trying to import a class in a file using 'import' keyword. But despite having read about the declaration of modules in...
Read more >Imports not working in TypeScript project. · Issue #199 - GitHub
When I am trying to import any of the Props into a TypeScript project, import sizes from "open-props/src/sizes" I get a ts(2307) Error:...
Read more >Common TypeScript module problems and how to solve them
Solution 2: Locate the module and resolve imports ; 'view/file2' with the first location in the array ( ; "*" ), and combine...
Read more >Documentation - Module Resolution - TypeScript
If you are having resolution problems with import s and export s in TypeScript, try setting moduleResolution: "node" to see if it fixes...
Read more >Auto-Import not resolving TypeScript source (not declarations ...
1. Create TypeScript project · 2. update the exclude line of your project's tsconfig. · 3. Export a class SignUpComponent in node_modules/@kabbage/angular/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey mate @oakgary , try using
sourcemaps: false
seems to work for meJust pushed a patch to handle non standard JSON tsconfigs.
https://github.com/AnomalyInnovations/serverless-bundle/releases/tag/v4.0.1