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

.mjs mimetype support #484

Closed
bjesuiter opened this issue Dec 19, 2018 · 6 comments
Closed

.mjs mimetype support #484

bjesuiter opened this issue Dec 19, 2018 · 6 comments
Milestone

Comments

@bjesuiter
Copy link

.mjs ECMA Script Module files are served with application/octet-stream MIME Type
instead of text/javascript, so the modules do not get imported in Chrome because of this error:

:8080/counter.mjs:1 Failed to load module script: The server responded with a non-JavaScript MIME > type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.

Can you serve these files with the correct mime type please? Sounds like a pretty minor change :)

@BigBlueHat
Copy link
Member

There's sadly a tangle of MIME-related dependencies to untangle. The underlying library dropped support for features we were using, so now we either need to re-implement them, drop them, or find other libraries to delegate the feature through...

Once we find the way through these woods, address this should indeed be trivial.

@neoeno
Copy link

neoeno commented Jun 15, 2019

Following the workaround (solution?) here got this working for me.

#448 (comment)

@thw0rted
Copy link

thw0rted commented Dec 3, 2019

Is there currently a way to declare custom MIME type mappings? If so, can somebody please a) document it in the README, or b) explain it briefly here so I can write up a PR with improved docs?

@Octalbyte
Copy link

Octalbyte commented Nov 20, 2020

You can use the mime-types from a JSON file, that would allow us to have more control and would probably also fix issues #623 and #35
Like:
let mime = JSON.parse(fs.readFileSync('./conf/mime.json',function(err,data){ return data }))
And set the respon content-type header.
//Supposing we've parsed the file extension to an ext variable
res.setHeader(content-type, mime[ext]|| 'application/octet-stream') //dummy setHeader function

@thornjad
Copy link
Member

This should be fixed by #693, I'm leaving this open for now so it gets checked after that merges.

@thornjad thornjad added this to the v0.13.0 milestone Jul 13, 2021
@thornjad
Copy link
Member

thornjad commented Aug 7, 2021

This appears to be fixed on master, please re-open if this is not the case.

@thornjad thornjad closed this as completed Aug 7, 2021
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

6 participants