You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
In a module that imports myExport from another module that has a class MyClass as a property, attempting to instantiate MyClass with
newmyExport.MyClass()
can sometimes result it the error
[Error] TypeError: _d7e.t is not a constructor
It seems like this kind of transformation lost a set of parentheses and attempts to call the .t as a constructor.
in 3.0.36:
new(_6c5.t("myExport",myExport)).MyClass()
in 3.0.37:
new_e8e.t("myExport",myExport).MyClass()
I was really struggling to consistently reproduce this since there seems to be some caching happening that I'm not fully aware of. Sometimes the transformed result would remain as new myExport.MyClass(), but after resetting my shell session, it changes to be one of the above without even touching the source files.
Anyway, here's a pretty minimal reproduction that should help explain:
// index.jsimport{myExport}from'./module';// the affected transformation only seems to happen with circular dependencies?exportdefault'foo';constfn=()=>{newmyExport.MyClass()}console.log(fn.toString());
The text was updated successfully, but these errors were encountered:
kherock
changed the title
3.0.37+ breaks behavior of new keyword with class under export
3.0.37+ breaks behavior of new keyword when accessing class under import
May 28, 2018
In a module that imports
myExport
from another module that has a classMyClass
as a property, attempting to instantiateMyClass
withcan sometimes result it the error
It seems like this kind of transformation lost a set of parentheses and attempts to call the
.t
as a constructor.in 3.0.36:
in 3.0.37:
I was really struggling to consistently reproduce this since there seems to be some caching happening that I'm not fully aware of. Sometimes the transformed result would remain as
new myExport.MyClass()
, but after resetting my shell session, it changes to be one of the above without even touching the source files.Anyway, here's a pretty minimal reproduction that should help explain:
The text was updated successfully, but these errors were encountered: