Error on Android devices - Failed to resolve module specifier three

Hello! There was a problem, some Android devices work fine, and some display the error Failed to resolve module specifier “three”. Relative references must start with either “/”, “./”, or “…/”.
How to fix this? Connection is made according to the instructions in the documentation.

<script type="importmap">
      {
        "imports": {
          "three": "https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js",
          "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"
        }
      }
    </script>

In script type=module

import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

I looked at all the topics with the same problem and didn’t find a solution.

The browser seems to ignore importmap. If remove it, then a similar error appears on all devices. It turns out that some devices do not support importmap? Is there a polyfill for such devices or something else to remove the error?

1 Like