-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 built-in hardcoded mime types does not handle webfont file extensions correctly #2337
Comments
Hopefully the internal list should be easy to update. Do you just need |
.otf -> font/otf 2)When the content returned by the onload callback in plugin contains the mime type, and the loader is specified as dataurl, can the mime type not to be overwritten? |
Ah, I see. If you specify
That's actually just the base64 encoding of your input:
I'm not sure quite what the best way to handle this is from within a plugin off the top of my head. Maybe having the URL be marked as external and for the external text to be the data URL? That way esbuild will leave it alone. But the easiest solution is for esbuild to just do it for you once the MIME types are updated. |
I understand, this defect is that I return the encoded content of dataurl in onLoad, which causes it to be recognized as text/plain in esbuild. After change to return rawdata,although not recognized by hardcoded mimetypes,but it is correctly handled by |
When using data-url loader to bundle webfont files in css,it failed to identify correct content-type.
actually:
url(data:text/plain;charset=utf-8;base64,ZGF0YTpmb250L3dvZm...
expected:
url(data:font/woff;charset=utf-8;base64,ZGF0YTpmb250L3dvZm...
After implementing my own onLoad plugin and returning the correct dataurl content,
it will eventually be modified to the wrong mime type.
The text was updated successfully, but these errors were encountered: