Hi So I dug deeper into this issue. turns out that the JS code for my port module was being emitted before the JS of Json.Decode module.
After some research, I found that if the project's port module has: - Name beginning with a letter before J, and - does not have a declared dependency on Json.Decode Then the elm compiler will emit the port module code before `Json.Decode` which causes all decoders to be `Undefined`. This results in all user defined incoming ports to stop throw exceptions. SSCCE: https://github.com/adityav/elm-ports-issue On Friday, 29 July 2016 02:27:41 UTC+5:30, Aditya Vishwakarma wrote: > > Hi > > I am getting Uncaught TypeError: Cannot read property 'tag' of undefined > in a sample code I built to tryout elm. The error happen when I send JSON > data across the elm port from JS side. > > Port defn: > https://github.com/adityav/elm-reddit-listing/blob/master/src/AppPorts.elm#L14 > JS call which causes this issue: > https://github.com/adityav/elm-reddit-listing/blob/master/src/index.js#L36 > git repo: https://github.com/adityav/elm-reddit-listing > > To run. Simply do > npm install && elm package install > npm start > > and open http://localhost:8080/. A listing of /r/elm should show up when > the app works. > > A screenshot of the exact location where the error occurs: > > > <https://lh3.googleusercontent.com/-5aH4m9n6gEw/V5pu35oQsEI/AAAAAAAAEbw/QKXJrtSqgcA6-Dfe_BVsDOYPpn9BHl6MACLcB/s1600/Screen%2BShot%2B2016-07-29%2Bat%2B1.39.20%2BAM.png> > > People on slack recommended me to remove elm-stuff/build-artifacts and try > again. It didn't work so I removed node_modules and elm-stuff directories > and reinstalled the whole thing. Didn't work as well. > The code was working before I decided to clean it up a little to show to > my teammates. Stopped working the moment I shared the github link with > them. :| > > anyone got any ideas on this? > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
