question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 3 years ago
  • Comments:32 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
jponccommented, Aug 6, 2020

Hey mate @oakgary , try using sourcemaps: false seems to work for me

1reaction
jayaircommented, Nov 14, 2020

Just pushed a patch to handle non standard JSON tsconfigs.

https://github.com/AnomalyInnovations/serverless-bundle/releases/tag/v4.0.1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found