DRACOLoader fails only on iOS Safari, only in production build
See original GitHub issueWhen loading a draco gltf model on a development build, I have no issue anywhere. When loading a draco gltf model on Safari iOS in production, I have a load of errors (THREE.DracoLoader: Unexpected attribute type
). It works on any other device/browser, and fails only on my production build.
In my experience, minification and optimization of code for production sometimes produces code that will fail on specific browsers, but I’m a bit clueless for this one. Did anyone ever experience that, and what would be a fix? The build is made with webpack 4.41.2, and it fails with both wasm and js draco decoders.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
IOS 15 Safari fails with Fairplay DRM playback
Hi, IOS 15 Safari does not support Fairplay DRM and gives an error, other browsers like ... The issue does not happen on...
Read more >DracoLoader wasm not working in iOS? : r/threejs - Reddit
Apart from that I just gave to dracoloader the decoder path exactly as it is laid out in the Threejs documentation and it...
Read more >Only mobile safari cannot open the page, no internet message
The same error on iPad Safari, so there is a problem with the served files. The website is programmed with PHP. What I...
Read more >@cgcs2000/deck.gl.layers | Yarn - Package Manager
Fix HeatmapLayer crash in iOS (Safari) (#3681) ... [jupyter-widget] use only one endpoint (#3493); Simplify pydeck widget build (#3462) ...
Read more >Debug JavaScript in Mobile Safari (iOS) in 8 easy steps
To only stop when an uncaught exception occurs, click the arrow icon beside the “Uncaught Exceptions” label. The error breakpoints dialogue when ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually, doing that an only that (ie. replacing the Constructors with their names as Strings)
was enough for me to get the DRACOLoader worker to work on Safari (iOS and desktop). In fact, in https://github.com/mrdoob/three.js/blob/c5560e5f94a9c40cba74fdb5f64b3794fecf0a4b/examples/jsm/loaders/DRACOLoader.js#L520
this will be evaluated to the Constructor, even if the passed in value is a String.
Thanks a lot for the pointer @donmccurdy!
(background to this is that it seems passing actual JavaScript Objects to the worker doesn’t really work in Safari. The
attributeTypes
was becoming{ position: "", normal: "", uv: "", uv2: "", ... }
in the worker context for me)–
EDIT 23.07.20 I was wrong, just changing
WEBGL_COMPONENT_TYPES
to contain strings breaks the non-draco loading, specifically at (for example) https://github.com/mrdoob/three.js/blob/c0039bc8fa31c7524a5ef2fd05bf96cb4c4d2a96/examples/jsm/loaders/GLTFLoader.js#L2083which then throws
TypedArray is not a constructor
error down the line, since it’s now aString
. To solve this, I had to do what @donmccurdy sugested in the first place (on top of changeWEBGL_COMPONENT_TYPES
to contain strings) and add the following utility function:as well as change a few lines in my GLTFLoader instead https://github.com/mrdoob/three.js/blob/c0039bc8fa31c7524a5ef2fd05bf96cb4c4d2a96/examples/jsm/loaders/GLTFLoader.js#L2083 to
and https://github.com/mrdoob/three.js/blob/c0039bc8fa31c7524a5ef2fd05bf96cb4c4d2a96/examples/jsm/loaders/GLTFLoader.js#L2135 to
Aaaand the mobile issue reported by the client was not related to draco at all.