Opened 10 years ago
Closed 10 years ago
#13789 closed bug (fixed)
variable module cannot accept 'null'
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 2.0.1 |
Component: | misc | Version: | 2.0.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
See L:8730.
typeof module === "object" && typeof module.exports === "object"
It occurs error when module === null.
I think that this condition should be:
typeof module == 'object' && module != null && typeof module.exports === "object"
Change History (5)
comment:1 Changed 10 years ago by
Owner: | set to ystk_skm <[email protected]…> |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Status: | pending → new |
---|
There are no huge impact for this bug, only requires some change if module is defined null at this position.
I think it's worth better to avoid such irregular.
<script>var module = null;</script> <script src="http://code.jquery.com/jquery-2.0.0.js"></script> // Uncaught TypeError: Cannot read property 'exports' of null
comment:3 Changed 10 years ago by
Component: | unfiled → misc |
---|---|
Milestone: | None → 2.0.1 |
Priority: | undecided → low |
Status: | new → open |
I agree, it shouldn't fail if module
is null
but I'd hope that isn't out in global scope very often.
Did your own code fail because of this, or did you just notice it while reading the code?
comment:4 Changed 10 years ago by
Just notice it while reading. I'm adjusting my resources for jQuery 2.0.0.
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #13789: Don't throw when module === null. Close gh-1269.
Changeset: eabb56c27484cbffd2ce4951f661df83c91e5d7a
Hi, thanks for contributing? Can you provide a test case and some more information about the problem?