Skip to content
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

When importing Pretender from a webpack build, RouteRecognizer constructor lookup fails. #207

Closed
cowboyd opened this issue Jul 20, 2017 · 1 comment

Comments

@cowboyd
Copy link

cowboyd commented Jul 20, 2017

When these lines run in a webpack build, https://github.com/pretenderjs/pretender/blob/master/pretender.js#L8-L9

RouteRecognizer and FakeXMLHttpRequest point to the module, not the default export.

Monkey patching it with this code makes it work:

  RouteRecognizer = RouteRecognizer.default || RouteRecognizer;
  FakeXMLHttpRequest = FakeXMLHttpRequest.default || FakeXMLHttpRequest;

Not sure what the long term solution is though.

@svicalifornia
Copy link
Contributor

svicalifornia commented Sep 22, 2017

I just submitted PR #216. My bad for not seeing #209 already fixes this, though you might prefer to merge #216, as its getModuleDefault function can be reused on more future module requires.

@trek trek closed this as completed in #216 Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants