wasm MIME type is not supported
mohammadrafigh opened this issue · 1 comments
Bug Report
Problem
What is expected to happen?
application/wasm
should be returned as MIME type for wasm files from static file server in iOS.
What does actually happen?
wasm libraries not working due to this error:
"Unexpected response MIME type. Expected 'application/wasm'"
Information
Here is an MR to Ionic that might be helpful:
https://github.com/ionic-team/capacitor/pull/5585/files
and another one in capacitor:
ionic-team/capacitor#6675
Command or Code
Just try to install and use a wasm library and run the app on simulator.
Environment, Platform, Device
Version information
Cordova: Cordova CLI 12.0.0, Cordova ios 7.0.0
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
I ran into the same problem with my project.
I find the Ionic PR helpful indeed. It can be applied to Cordova as well.
As a quick solution until #1374 is merged, the following code can be added to a project's config.xml
at the <platform name="ios">
node. It ensures the necessary changes are inserted into the Info.plist file when the project is built, without the need to modify the local cordova-ios module:
<config-file parent="UTImportedTypeDeclarations" target="*-Info.plist">
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>WebAssembly</string>
<key>UTTypeIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>wasm</string>
<key>public.mime-type</key>
<string>application/wasm</string>
</dict>
</dict>
</array>
</config-file>