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

Check the module object itself for accessing module.exports #319

Merged
merged 5 commits into from
Nov 17, 2016
Merged

Check the module object itself for accessing module.exports #319

merged 5 commits into from
Nov 17, 2016

Conversation

mttwc
Copy link
Contributor

@mttwc mttwc commented Nov 17, 2016

On some sites, the exports variable is being used for other (non-node) things, resulting in the wrong code path being executed, leading to Uncaught ReferenceError: module is not defined(…). This PR adds an additional check for the module object itself before trying to access it.

Fixes #318

@rodneyrehm
Copy link
Member

Thank you!

Is there a reason to not go with typeof module === 'object' && module.exports instead, as umd/returnExports.js shows? I mean other than the original code testing for typeof exports === 'object' and this fix being the smallest possible change?

@mttwc
Copy link
Contributor Author

mttwc commented Nov 17, 2016

Not that I can think of, good call :)
I'll amend it now!

@larsendaniel
Copy link

👍

@rodneyrehm rodneyrehm merged commit e5e985b into medialize:master Nov 17, 2016
@rodneyrehm
Copy link
Member

Thank you!
Your fix has been released as v1.18.3

@mttwc
Copy link
Contributor Author

mttwc commented Nov 17, 2016

Excellent! Thanks for being so quick on this!

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 this pull request may close these issues.

None yet

3 participants