“Multiple instances of Three.js being imported” from CDN

Describe the bug

Three r125 now checks if multiple different instances of the library are being imported. Weirdly, though, this is already triggered simply by following the “Installation” section of the documentation:

<script type="module">
  import * as THREE from "https://unpkg.com/three/build/three.module.js";
  import { OrbitControls } from "https://unpkg.com/three/examples/jsm/controls/OrbitControls.js";
  /* Warning triggered */

Here’s a Codesandbox with the issue:

I’ve tried a bunch of other ESM CDNs (skypack and jspm, specifically), with the same results.

To Reproduce

  1. Visit the codesandbox
  2. Check the console output


See above.

Live example

Expected behavior

There should not be a warning that multiple instances are being imported if they’re being imported via JS modules from CDNs.


  • Three.js version: [r125]

1 possible answer(s) on ““Multiple instances of Three.js being imported” from CDN

  1. I’m unsure about this issue. It seems to me the mentioned problem is a general JavaScript thing. Or is there a concrete suggestion for a change in three.js?

    The bug is that this happens when following the official instructions on the website. As @donmccurdy already pointed out, it could be argued that this is a bug with the documentation, not the library itself.