-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewire API added to module twice #57
Comments
Interesting. I'd imagine this could be a problem with any of the rewire flavors. I recently ran into this error with rewire-global but didn't look into it yet. Any module that just exports one of its dependencies exports would have this problem. @i-like-robots, have you come across this? @jhnns, perhaps we should be adding a check that these functions don't already exist in https://github.com/jhnns/rewire/blob/master/lib/getDefinePropertySrc.js This is further reason why we should figure out how to be sharing all this code between all these modules ala i-like-robots/rewireify#17 |
I have a commit which fixes my instance of this. I've been able to test the changes in M |
@mbfisher thanks for reporting this issue and creating the PR. Your issue is resolved by #62. Generally patterns like in your sample were an existing class is changed and then reexported should be avoided, as this always modifies the original class. If this is intended and you want to be able to rewire the modified as well as the original module it is recommended to use the RewireApi object. |
Cheers! M On Thursday, 1 October 2015, speedskater [email protected] wrote:
Mike Fisher Email: [email protected] |
A contrived example:
This leads to an error whereby
__Rewire__
is added to theMyClass
export inMyClass.js
andindex.js
, causingObject.defineProperty
to fail the second time around:I'd love have a go at a PR for this but have never worked with the Babel internals and it looks a bit mad...
M
The text was updated successfully, but these errors were encountered: