Closed keidarcy closed 1 year ago
When using namespace import with config like
import * as config from "config"; for (const p in config) { console.log("p:", p); }
$ node -r @swc/register src/index.ts p: a p: default
output has no function get or has
get
has
import config from "config"; for (const p in config) { console.log("p:", p); }
$ node -r @swc/register src/index.ts p: a p: util p: get p: has
output has functions like get or has
I'm not sure should @swc/register treat namespace import and default import the same. Is there a flag like in esModuleInterop in tsconfig.json to change the behavior?
@swc/register
"module": { "type": "commonjs", "strict": true, "noInterop": true <--- },
I found this flag to make this work.
Descirbe
When using namespace import with config like
output has no function
get
orhas
output has functions like
get
orhas
Playground link
Question
I'm not sure should
@swc/register
treat namespace import and default import the same. Is there a flag like in esModuleInterop in tsconfig.json to change the behavior?