eeue56/elm-static-html

Javascript variable name error

Closed this issue · 2 comments

Hey, great package! Thank you very much!

I was getting this error:

...
C:\...\elm-static-html\elm.js:9071

var _elm-lang$html$Native_Jsonify = {
        ^

SyntaxError: Unexpected token -
...

So I look around at the code and notice that the github username from elm-package.json is begin inserted there. My repository was https://github.com/elm-lang/html.git (I just copied the easiest elm-package.json source).

Apparently javascript's variables can't have - in the name. Changing my repository declaration in elm-package.json to https://github.com/elm_lang/html.git solved the issue.

The Elm compiler sanitize the username taken from the github repository before generating the javascript. Elm generated variables name was _elm_lang$html$.... How is it done? I don't know.

Opening the issue so anyone that has similar issue see a work around.

yep, needs to be lowercased. I can fix that

published as 1.1.1! thanks!