wking-io / elm-live

⚡ A flexible dev server for Elm. Live reload included.
https://elm-live.com
MIT License
1.05k stars 61 forks source link

Serving .js files as HTML leading to a blank page #273

Closed nsadeh closed 11 months ago

nsadeh commented 11 months ago

I am running 4.0.2 on MacOS Ventura 13.4 and Elm 0.19. 1.

My command is as follows:

elm-live src/Main.elm --port=3000 --pushstate -h myhost.me --start-page=dist/index.html -- --output=dist/app.js --debug

Also tried

elm-live src/Main.elm --port=3000 --pushstate -h myhost.me --dir=dist -- --output=dist/app.js --debug

My issue is: when navigating to myhost.me:3000 (or just localhost:3000 if I don't have the hostname up), I see a blank page. In the console log, I see the error: Uncaught SyntaxError: Unexpected token '<'

This refers to my app.js file line 1.

Upon opening the sources tab, I see that the app.js is some HTML file that seems to be my index.html file, only it's in the app.js file. When I cat my dist/app.js file, I do see the correct JS in there.

There seems to be an issue with the web server here, am I doing something wrong?

nsadeh commented 11 months ago

Here is where my index.html references the JS:

        <script type="text/javascript" src="app.js?v=0"></script>
nsadeh commented 11 months ago

My bad - in this repo there was a versioning string attached to some files that caused them to be missed.