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

sources for .scala files not loading on chromium #3

Open
busti opened this issue May 14, 2022 · 2 comments
Open

sources for .scala files not loading on chromium #3

busti opened this issue May 14, 2022 · 2 comments

Comments

@busti
Copy link

busti commented May 14, 2022

The source-mapping should enable the chrome-dev-tools to show .scala source files.
In firefox this works as expected. However in chromium inspecting a .scala file results in the following error message being shown instead of the source file:

Could not load content for http://localhost:12345/src/main/scala/webapp/Main.scala (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

What's interesting to note is that following the link to the .scala file results in the file being downloaded instead of being displayed. Maybe there are some faulty http headers at fault?

I tested this on the current branch of the outwatch/seed.g8 project and chromium Version 98.0.4758.102

@busti
Copy link
Author

busti commented May 15, 2022

Investigating further, turns out .scala files are served with the Content-Type: application/octet-stream mime type instead of application/javascript or similar, which causes chrome to try to download them.
Webpack dev server allows for mime types to be extended using https://webpack.js.org/configuration/dev-server/#devserverdevmiddleware , however I have not yet been successful in adding that.
Do you perhaps know if it is possible to get more verbose output from webpack while it is being ran by sbt?

@cornerman
Copy link
Member

Good catch! I was not aware of that.

Investigating further, turns out .scala files are served with the Content-Type: application/octet-stream mime type instead of application/javascript or similar, which causes chrome to try to download them.

Interesting thought! I had issues with this "default" content-type before somewhere else. What would be the correct content type for scala files by the way? Text? 🤔

Do you perhaps know if it is possible to get more verbose output from webpack while it is being ran by sbt?

Not inside sbt, but when running webpack directly. It would be something like this:

node target/scala-2.13/scalajs-bundler/main/node_modules/webpack/bin/webpack --bail --profile --json --config target/scala-2.13/scalajs-bundler/main/webpack.config.js

Hope that helps. I did not have time to look into it further.

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

2 participants