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

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

Closed
nsadeh opened this issue Oct 31, 2023 · 2 comments
Closed

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

nsadeh opened this issue Oct 31, 2023 · 2 comments

Comments

@nsadeh
Copy link

nsadeh commented Oct 31, 2023

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
Copy link
Author

nsadeh commented Oct 31, 2023

Here is where my index.html references the JS:

        <script type="text/javascript" src="app.js?v=0"></script>

@nsadeh
Copy link
Author

nsadeh commented Oct 31, 2023

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

@nsadeh nsadeh closed this as completed Oct 31, 2023
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

1 participant