<p dir="auto">Importing from <code class="notranslate">three/examples/jsm/.../&lt;module&gt;</code> causes bundlers (tested with rollup) to include the library twice (or multiple times).</p>
<p dir="auto">For example, when doing <code class="notranslate">import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'</code>, the bundler will follow the import and in the OrbitControls.js the imports come from  <a href="https://github.com/mrdoob/three.js/blob/dev/examples/jsm/controls/OrbitControls.js#L18"><code class="notranslate">../../../build/three.module.js</code></a>. However, there is no way for the (external) bundler to know that <code class="notranslate">../../../build/three.module.js</code> is the same module as <code class="notranslate">three</code>.</p>
<p dir="auto">A solution for this would be to treat the examples modules as external packages and import from <code class="notranslate">three</code> instead of <code class="notranslate">../../../build/three.module.js</code>. This might break the rollup config of three.js, but it should be possible to tell rollup that <code class="notranslate">three</code> is an alias for the main entry point of three (<code class="notranslate">src/Three.js</code>).</p>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">In version R90 I have an atlas that is loaded/created with:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="new THREE.TextureLoader(manager).load(url, function(t){
         //Upload to gpu 
	renderer.setTexture2D(t, 0);
         //Frames is the atlas data.
	for (name in frames)
	{
		var frame = frames[name];
		var tex = t.clone();
		tex.uuid = t.uuid; // prevents loading texture multiple times
		tex.repeat.set(frame.w / t.image.width, frame.h / t.image.height);
		tex.offset.x = ((frame.x) / t.image.width);
		tex.offset.y = 1 - (frame.h / t.image.height) - (frame.y / t.image.height);
		tex.needsUpdate = true;
		
                                  //AssetManager is just a map for quick access to textures.
		AssetManager.add(n, tex);
	}
});"><pre class="notranslate"><span class="pl-k">new</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">TextureLoader</span><span class="pl-kos">(</span><span class="pl-s1">manager</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-s1">url</span><span class="pl-kos">,</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">t</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
         <span class="pl-c">//Upload to gpu </span>
	<span class="pl-s1">renderer</span><span class="pl-kos">.</span><span class="pl-en">setTexture2D</span><span class="pl-kos">(</span><span class="pl-s1">t</span><span class="pl-kos">,</span> <span class="pl-c1">0</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
         <span class="pl-c">//Frames is the atlas data.</span>
	<span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-s1">name</span> <span class="pl-k">in</span> <span class="pl-s1">frames</span><span class="pl-kos">)</span>
	<span class="pl-kos">{</span>
		<span class="pl-k">var</span> <span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-s1">frames</span><span class="pl-kos">[</span><span class="pl-s1">name</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
		<span class="pl-k">var</span> <span class="pl-s1">tex</span> <span class="pl-c1">=</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
		<span class="pl-s1">tex</span><span class="pl-kos">.</span><span class="pl-c1">uuid</span> <span class="pl-c1">=</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">uuid</span><span class="pl-kos">;</span> <span class="pl-c">// prevents loading texture multiple times</span>
		<span class="pl-s1">tex</span><span class="pl-kos">.</span><span class="pl-c1">repeat</span><span class="pl-kos">.</span><span class="pl-en">set</span><span class="pl-kos">(</span><span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-c1">w</span> <span class="pl-c1">/</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">image</span><span class="pl-kos">.</span><span class="pl-c1">width</span><span class="pl-kos">,</span> <span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-c1">h</span> <span class="pl-c1">/</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">image</span><span class="pl-kos">.</span><span class="pl-c1">height</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
		<span class="pl-s1">tex</span><span class="pl-kos">.</span><span class="pl-c1">offset</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-c1">x</span><span class="pl-kos">)</span> <span class="pl-c1">/</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">image</span><span class="pl-kos">.</span><span class="pl-c1">width</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
		<span class="pl-s1">tex</span><span class="pl-kos">.</span><span class="pl-c1">offset</span><span class="pl-kos">.</span><span class="pl-c1">y</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span> <span class="pl-c1">-</span> <span class="pl-kos">(</span><span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-c1">h</span> <span class="pl-c1">/</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">image</span><span class="pl-kos">.</span><span class="pl-c1">height</span><span class="pl-kos">)</span> <span class="pl-c1">-</span> <span class="pl-kos">(</span><span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-c1">y</span> <span class="pl-c1">/</span> <span class="pl-s1">t</span><span class="pl-kos">.</span><span class="pl-c1">image</span><span class="pl-kos">.</span><span class="pl-c1">height</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
		<span class="pl-s1">tex</span><span class="pl-kos">.</span><span class="pl-c1">needsUpdate</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>
		
                                  <span class="pl-c">//AssetManager is just a map for quick access to textures.</span>
		<span class="pl-v">AssetManager</span><span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-s1">n</span><span class="pl-kos">,</span> <span class="pl-s1">tex</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">In addition to atlas I have large equirectangular textures loaded. With version 90 (and 89) renderer.info.memory says 23 textures when scene is being rendered and it keeps at that whenever objects found in the scene are set to visible / invisible.</p>
<p dir="auto">With R91 and newer the texture count starts to ramp up quickly. Initial state has textures set at 79 (most likely due to overlay ui which has lots of assets all found in one atlas. Whenever I click an area where object is and it is set to visible then the count jumps by some sum (depending on what the object is). All of the textures used on objects are found in another atlas image.</p>
<p dir="auto">Checking with the debugger in R90 and R89 texture upload is done only initially. In R91+ it happens everytime an object is set to visible (one that has not been visible before).</p>
<p dir="auto">Will provide an example after I find some images I can distribute freely.</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r94</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r93</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r92</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r91</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Chrome (67.0.3396.87)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Firefox (61.0)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<p dir="auto">Most likely also IE. Cannot test with one at the moment.</p>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>
<h5 dir="auto">Hardware Requirements (graphics card, VR Device, ...)</h5>
<p dir="auto">GPU used in tested is nvidia 1060 and 770.</p>