elm-lang / elm-repl

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

[alpha] "ReferenceError: document is not defined" when importing an HTML-based module into the REPL #135

Closed clarkware closed 7 years ago

clarkware commented 7 years ago

Elm 0.18.0 Mac OS X Version 10.11.6 Node.js v5.4.0

Given the following Elm code that generates HTML:

module Hello exposing (..)

import Html exposing (text)

main =
    text "Hello, World!"

Importing the module in the REPL gives the following error:

> import Hello
/path/to/repl-temp-000.js:5703
var localDoc = document;
               ^

ReferenceError: document is not defined
    at /path/to/repl-temp-000.js:5703:16
    at Object.<anonymous> (/path/to/repl-temp-000.js:7748:2)
    at Object.<anonymous> (/path/to/repl-temp-000.js:7946:4)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:1003:3
process-bot commented 7 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

Thanks for the report! If you delete elm-stuff/ and try again it should be fixed!

clarkware commented 7 years ago

Indeed, that fixed it. Thanks!