Skip to content

Commit

Permalink
Enable building with webpack
Browse files Browse the repository at this point in the history
When building with WebPack, `require('x') returns the module, not the
default export, so this just peels off the default export from the
module, if it's present.
  • Loading branch information
cowboyd committed Jul 20, 2017
1 parent cc2a094 commit 2acdea4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pretender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ var appearsBrowserified = typeof self !== 'undefined' &&
var RouteRecognizer = appearsBrowserified ? require('route-recognizer') : self.RouteRecognizer;
var FakeXMLHttpRequest = appearsBrowserified ? require('fake-xml-http-request') : self.FakeXMLHttpRequest;

// When building with WebPack, `require('x') returns the module, not the default export.`
RouteRecognizer = RouteRecognizer.default || RouteRecognizer;
FakeXMLhttpRequest = FakeXMLhttpRequest.default || FakeXMLhttpRequest;


/**
* parseURL - decompose a URL into its parts
* @param {String} url a URL
Expand Down

0 comments on commit 2acdea4

Please sign in to comment.