eeue56 / elm-static-html

Statically render html from Elm!
BSD 3-Clause "New" or "Revised" License
87 stars 10 forks source link

Javascript variable name error #1

Closed pablohirafuji closed 7 years ago

pablohirafuji commented 7 years ago

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.

eeue56 commented 7 years ago

yep, needs to be lowercased. I can fix that

eeue56 commented 7 years ago

published as 1.1.1! thanks!