question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

examples/jsm files import change broke https://threejs.org hot-linking and code samples in the manual

See original GitHub issue

Describe the bug

This has broken a lot of stuff but in my local repo, and some in the official examples.

Getting:

Uncaught typeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./". or "../"

I’m running chrome on windows.

Spent a lot of time wondering about this until I saw another user with the same problem… Now I’m seeing that the addition of the new polyfill by looking at the examples and perusing the threads:

<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>

<script type="importmap">
	{
		"imports": {
			"three": "../build/three.module.js"
		}
	}
</script>

Is this documented anywhere?

Also, can this shim at least pulled into the threejs repo until it’s stable/widespread? It seems problematic to have the library now require a quiet import from some random external CDN.

Looking here, seems to indicate it breaks every browser except chrome/opera ??

https://caniuse.com/import-maps

Can someone explain to me what value this change brings to the ecosystem to justify its adoption before its supported in all browsers?

From what I can tell, it basically takes a shotgun to the ecosystem of codepen/glitch/jsfiddle examples that already exist that rely on the existing behavior.

Is there a way to automatically pull in the shim on import of three.module.js for browsers without support, without requiring everyone to manually add the shim to their html?

I burned an evening trying to work around this, thinking that it was some new/updated chrome restriction.

Now I’m seeing other people having this issue.

import * as SkeletonUtils from 'https://threejs.org/examples/jsm/examples/SkeletonUtils.js';

Live example

The codepen examples on this manual page are broken: (https://threejs.org/manual/#en/load-obj)

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem (drag and drop the image).

Platform:

  • Device: [Desktop, Mobile]
  • OS: [Windows, MacOS, Linux, Android, iOS]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: [dev, r???]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:37 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
Mugen87commented, Jan 29, 2022

And, all the codes in manual importing modified modules are also broken.

We have already fixed that on dev and master. It’s just not yet published on github-pages.

https://github.com/mrdoob/three.js/blob/dev/manual/examples/load-obj-materials.html

2reactions
marcofugarocommented, Jan 28, 2022

@fbellomi hello, you have to use the .js extension in node, now that three.js is an ES Module:

-import { Line2 } from "three/examples/jsm/lines/Line2";
+import { Line2 } from "three/examples/jsm/lines/Line2.js";

commented also here: https://github.com/mrdoob/three.js/pull/23245#issuecomment-1023648327

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent image hotlinking - DreamHost Knowledge Base
Overview Hot linking or bandwidth stealing is a common problem. It happens when people link to files and images on a different server......
Read more >
How to Prevent Image Hotlinking in WordPress (And Why You ...
Learning how to prevent image hotlinking in WordPress can protect you against sites that try to steal your media.
Read more >
Hotlinking: What Is It & How To Prevent It in 2022 - Pixsy
Hotlinking is linking and embedding an image, so it is hosted by the original server, not the linking page. Learn why it's bad...
Read more >
Hotlink IFC File | User Guide Page - Graphisoft Help Center
Place IFC files as hotlinks directly into the currently open Project as protected ... IFC Structural Analysis Model Import/Export - Experimental Feature.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found