import qs is undefined, but works with require

Rodrigo

I have a code that runs on NodeJS 14 on Google Cloud Functions, I am using typescript with tsc to compile my code.

import qs from 'qs'

console.log(`qs >>> ${qs})

The code above logs (in production)

qs >>> undefined

I think the problem is my tsconfig, could someone help to check if there is some something non usual on my configuration?

If I use require('qs') the code works.

My tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017",
    "allowSyntheticDefaultImports": true
  },
  "compileOnSave": true,
  "include": ["src", "tests"]
}
Roman P.

Try it with:

import * as qs from 'qs'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related