asapach / babel-plugin-rewire-exports

Babel plugin for stubbing [ES6, ES2015] module exports
MIT License
66 stars 7 forks source link

warnings in combination with typescript #23

Closed PSeitz closed 4 years ago

PSeitz commented 4 years ago

I get a lot of errors of the kind below. In my setup I'm also using @babel/plugin-transform-typescript.

The exported identifier "_ObjectKind" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.

This problem is likely caused by another plugin injecting
"_ObjectKind" without registering it in the scope tracker. If you are the author
 of that plugin, please use "scope.registerDeclaration(declarationPath)".
sergei-startsev commented 4 years ago

Hi @PSeitz. Can you provide a minimal program that reproduces this warning?

CodyRay commented 4 years ago

I have observed the same errors in another typescript project, here is a simple repro. I found that the error only occurred when using default exports or const exports with unsafeConst: false.

I found this similar issue, but I am not sure how to apply a similar fix to this plugin

asapach commented 4 years ago

Thanks for the repro, @haroldhues! I've published v2.1.0 - please try it out.