elm-lang / elm-repl

A REPL for Elm
BSD 3-Clause "New" or "Revised" License
170 stars 34 forks source link

document is undefined when importing Mouse #125

Closed jweissman closed 7 years ago

jweissman commented 8 years ago

Really putting this here just in case someone else might run into this -- if you're importing something that does an import Mouse somewhere, you'll get a ReferenceError: document is not defined sort of crash message from JS, although the REPL doesn't crash -- it just hasn't imported the module.

Maybe it's possible to catch the case where a user is loading something that requires document and warn the user? Or conversely we could provide a null object kind of document that the repl can use just to import the module.


After import Mouse, or importing anything that does, we get a JS stacktrace that looks something like this:

/.../etc/elm/project/repl-temp-000.js:6812
        onDocument: F3(on(document)),
                          ^

ReferenceError: document is not defined
    at /../etc/elm/project/repl-temp-000.js:6812:20
process-bot commented 8 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 7 years ago

Should be fixed by https://github.com/elm-lang/dom/commit/7ea94b1ee2e7cdfd54bc7cee8e761dba364b31ce and https://github.com/elm-lang/dom/commit/22e3f2f4170e441d318e85a380379655ffeb53c6 which are coming with 0.18. Thanks for the report!

xpe commented 7 years ago

@evancz Thanks for the fix. Can you post a work-around for 0.17? I don't see any Mac builds easily available for 0.18.

evancz commented 7 years ago

It's coming out in the next few days, so just hold on for a little while longer.