-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
The dev server uses mime type "video/mp2t" #2642
Comments
For those seeking to fix this: it is notable that It is technically possible to detect an MPEG transport stream by the fact that it has an ASCII capital G();
function G() { console.log('Valid TypeScript'); } Yes, this is a contrived example, but it runs. Despite this fact, it is most likely that most people using the Vite server are serving TypeScript instead of MPEG transport streams. Since MPEG is the outlier case here, it is in my opinion fine for Vite to temporarily override all |
This fixes vitejs#2642. Thanks a lot to @lukeed, maintainer of Sirv, for the suggestion! lukeed/sirv#103 (comment)
This fixes vitejs#2642. Thanks a lot to @lukeed, maintainer of Sirv, for the suggestion! lukeed/sirv#103 (comment)
This fixes vitejs#2642. Thanks a lot to @lukeed, maintainer of Sirv, for the suggestion! lukeed/sirv#103 (comment)
I'm running into this in production with audio-worklets. On a side note, it would be nice to have a "*?worklet" hook that registers the module automatically. Maybe by extracting the name from the registerProcessor call in the worklet itself? |
@kgullion could you open a new issue with a minimal reproduction linking to this one so we can properly track your issue? Thanks! |
Describe the bug
When getting
.ts
files from the vite server, they are delivered with the wrong mime type.Expected would be
Content-Type: text/javascript
but instead we getContent-Type: video/mp2t
.Reproduction
A simple minimal vite project, with a .ts file to be transpiled, should be enough. See the
curl
call below for reproducing it.System Info
vite
version: 2.1.2npm: 6.14.10
Logs (Optional if provided reproduction)
Example curl command:
Possible cause of the bug
Looks like vite uses the module
sirv
under the hood to serve the files. Sirv uses the mime which makes from file extension to Content-Type. Looks likemime
maps.ts
tovideo/mp2t
.The text was updated successfully, but these errors were encountered: