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
hasModule check fails if require is not defined #1537
Comments
The check for |
Does mr. @ichernev agree? |
@jgerigmeyer do you know why in qunit tests moment is used as a browser global. Also does QUnit have So QUnit defines |
At the time I was using moment in a non-CommonJS/RequireJS project, and testing custom language settings via QUnit tests, which is why I was accessing moment as a browser global. (I've since decided unit tests don't need to test actual moment functionality, so I'm no longer doing this.) QUnit itself does not define In short, I agree that #1238 should probably be reverted. I'm sure I'm being slow, but why is accessing moment via a browser global being discouraged? |
It's not being discouraged in general. It's being discouraged in the presence of |
Ah yes, I see that now. Makes perfect sense, #1238 should be reverted, and I apologize for not discovering the sinon.js bug before submitting that pull request 5 months ago. |
…g when using with QUnit)." This reverts commit ed6a2d4. This was discussed in moment#1537 (comment)
For the record, Qunit exports itself to There has been an attempt to extend exports for more environments, but that isn't really going anywhere. |
Well we started from UMD (not really) and then patched it until every hostile environment and use case is supported. The state of the js module systems is just sad, very sad. |
Closed by #1588 |
I'm using webpack to build the bundle and after recent update moment.js gets incorrectly included into the module. Here is the full story: webpack/webpack#204 (comment).
This happens because it tries to check if the
require
is defined, I'm assuming this was done with a reason, but is it still valid these days?Ideally this should be like this:
Or if the
require
check is beneficial for some reason, then perhaps like this:The text was updated successfully, but these errors were encountered: