Open gaearon opened 8 years ago
(I should say that, of course, refreshing helps. The mess up only occurs when label.jsx
is reevaluated after a newly added file is imported.)
Thanks for the clear bug report! I'll look into this soon. There's a few issues I've seen that have to do with files being added or removed from the bundle at runtime.
damn.. I met this error msg when I wrote const [a, b] = (null)
I met this when I wrote const [,field2,field3] = componentsArray;
reactTransform
branchstuff.js
)npm start
the examplerequire('./stuff');
inlabel.jsx
Expected: the file is normally imported. Actual:
TypeError: Invalid attempt to destructure non-iterable instance
.The error is being caught by the HMR code, but it seems thrown at the module evaluation time.
If you enable "pause on caught exceptions" in Chrome debugger, you'll see that the original exception happens during evaluation of the
label.jsx
code:What strikes me as odd is that
_interopRequireDefault
Babel helper seems to actually point tosliced-to-array
helper (note the filename in the popup). It explains the weird exception:_interopRequireDefault
is a function that checks export fordefault
, butslicedToArray
is a completely different helper that expects an iterable.It appears that something in the HMR machinery causes module IDs to get messed up, so
require()
made by Babel to one of its runtime utilities resolves to a different utility.