GLTF models distorted when exporting from Blender

I know this is more of a Blender/GLTF question than a three.js question, but I’m not sure where to go for help on issues relating to the internals of GLTF.

Basically when I export my character from blender and import it into the GLTF viewer, the pose looks distorted:

However, the pose is only distorted if it is not the selected animation when I export from Blender. If the animation is selected in the Action editor at the time of export, then the character looks normal:

This affects all animations in the GLTF file - only the animation that is currently selected in Blender when I do the export looks correct. Note that I tried several different GLTF viewers, so it’s not a problem with the viewer.

I thought perhaps the problem might be that some bones were not getting initialized in the animation, but that is not the case - every bone is keyframed at frame 0 with location, rotation and scale.

Any ideas?

I think that this is because of the armature which has problem with modifiers in blender.