-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: mjs file extension for browser code is not working in nginx #20157
Comments
Had the same issue and could fix it in the nginx conf by adding:
if it helps anyone :) |
We could fix this the proper way, or the dirty way (or not at all). Dirty way: Proper way: I think doing the proper option is too high risk for The dirty option is an big no-no for me personally, Search-and-replace in source-code is a no-no. SO with all that in mind, My recommendation would be to: not support this.
I'm curious about your thoughts @tmeasday @kasperpeulen |
I'm inclined to agree with your analysis @ndelangen. |
@shilman if you also agree, I propose we close this issue, or move it from the 7.0 project board |
Shiver me timbers!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.9 containing PR #20277 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Still coming across this issue in Storybook 7.0.0-beta.24 |
@MineDrum yes, that's to be expected, the resolution we ended up on is:
You'll need to add |
Still coming across this issue in Storybook 7.0.0-beta.60. Thanks to @stefanetoh. My docker solution:
|
Does this mean it can't be hosted in aws s3 as a static website anymore? I don't think s3 supports .mjs. It's a bit of a pain honestly Mine is throwing in console: |
Also a pain for serving storybook off of github pages that do not have an updated mime-db package. There is no way to configure mime types in github pages, so we cannot serve .mjs files properly. It would be nice if there was an option to transpile to .js. |
@redonkulus perhaps you could write to the GitHub support forum? |
If you add that, you will get the following nginx warning:
Also, For my case, just specifying the
|
Depends on your setup. Anyways, should be using |
There are a lot of servers that don't serve |
Yes, for example Bitbucket Web Pages don't serve it with a javascript mime type. |
Here to point out that even Salesforce Commerce Cloud doesn't (and can't) support serving .mjs with text/javascript MIME Type. |
I'm not sure this is the same issue, but I'm using |
I have this workaround for deploying to s3 with bitbucket pipelines. The first pipe uploads everything except mjs files, and the second pipe uploads only the mjs files while setting the correct content-type.
|
This adds notes from storybookjs#20157.
Describe the bug
This bug applies to Storybook 7, when serving the finished build of Storybook.
With some servers (nginx for example) the .mjs files (manager.mjs, runtime.mjs) are served to the browser with content-type
application/octet-stream
instead oftext/javascript
.One could make a point that this is a bug in the HTTP servers, and the way to fix it is to tweak MIME types so that mjs and cjs are identified as
text/javascript
. However, the issues could also be fixed in Storybook by serving the manager and runtime with a.js
extension.To Reproduce
System
Additional context
No response
The text was updated successfully, but these errors were encountered: