Error: export 'XRRigidTransform' (imported as 'XRRigidTransform') was not found in 'three'

Build fails when referencing XRRigidTransform from three import

import { XRInputSource, XRRigidTransform } from “three”;

const offsetPosition = { x: 0, y: 0, z: 0, w: 1 };
const offsetRotation = new Quaternion();
const transform = new XRRigidTransform(offsetPosition, offsetRotation);

XRInputSource (interface) is found, but XRRigidTransform (class) is not.

  • Browser: [Edge]
  • NGT [5.4.0]
  • Three.js version: [r140 or r141]

Any suggestions is appreciated.

Like mentioned at GitHub, you can’t import both types from the three package. They are no classes from three.js but part of the WebXR device API.

For angular projects, need to npm i @types/webxr and modify tsconfig.app.json (not tsconfig.json) to include “types”: [ “webxr” ] under compiler options.

Hopefully, this solution helps someone.

1 Like