Skip to content
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

Error in console using hot-reload #225

Closed
lucamug opened this issue Apr 6, 2020 · 4 comments
Closed

Error in console using hot-reload #225

lucamug opened this issue Apr 6, 2020 · 4 comments

Comments

@lucamug
Copy link
Contributor

lucamug commented Apr 6, 2020

Is it only me that is getting this error?

"main-with-debugger.js:65597 Uncaught ReferenceError: module is not defined"

Screen Shot 2020-04-06 at 13 44 22

Screen Shot 2020-04-06 at 13 44 41

module is defined in elm-live/lib/src/websocket.js:


// The following 20 lines are from https://github.com/klazuka/elm-hot/blob/master/test/client.js#L40
var myDisposeCallback = null

// simulate the HMR api exposed by webpack
var module = {
  hot: {
    accept: function () {},

    dispose: function (callback) {
      myDisposeCallback = callback
    },

    data: null,

    apply: function () {
      var newData = {}
      myDisposeCallback(newData)
      module.hot.data = newData
    }

  }
};

I don't remember how this was injected in the Elm code... maybe there is an issue there?
I felt this was working few days ago, so maybe is only me that screwed something...

@lucamug
Copy link
Contributor Author

lucamug commented Apr 6, 2020

I eventually found that this issue is coming from this other issue (#220) that I opened in the past. When my index.html has parameters, the automatic reload stop working...

@lucamug lucamug closed this as completed Apr 6, 2020
@kraklin
Copy link

kraklin commented Apr 10, 2020

I ran into this issue right now without having any query parameters, I have just turn on the hot reloading on simple one Elm file app :(

@kraklin
Copy link

kraklin commented Apr 10, 2020

If I start elm-live with --open parameter it works, only when I manually reload the page I cannot see any of the page content.

@balovbohdan
Copy link

I also had a similar issue setting up routing. Appeared that the problem was in relative paths in the index.html. So, I changed

<script type="text/javascript" src="./index.js"></script>

to

<script type="text/javascript" src="/index.js"></script>

and it solved my problem. Hope this will help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants