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.

Uncaught TypeError when accessing OrbitControls from unpkg.com

See original GitHub issue

With version 128, the following code:

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

causes the following error:

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

It worked fine in 127 though.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
x1911commented, May 7, 2021

@Mugen87 https://jsfiddle.net/x1911/3x0rv8y9/

it stucks in gltf loader loading

2reactions
donmccurdycommented, May 3, 2021

Looks like unpkg has an experimental ?module option you can add to the URL that allows it to work with three.js too:

https://discourse.threejs.org/t/importing-jsm-modules-using-explicut-urls-no-longer-works-for-basic-jsfiddle-examples-since-r128/25858/3

I’d be curious if you are seeing loading time differences between Skypack and Unpkg?

That said, yes, local development will allow you to work much faster. So far https://www.skypack.dev/ seems like one of the more user-friendly options. Then you can deploy to something with a CDN cache (e.g. netlify handles this automatically) when you are finished working locally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

9 - Stack Overflow
Not using node.js : Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "..
Read more >
three-orbitcontrols/README.md - UNPKG
I decided to create another package with a different approach, see [this issue for the rationale](https://github.com/mattdesl/three-orbit-controls/issues/17).
Read more >
Why the import path for three in CDN of OrbitControls is ...
CDN of OrbitControls.js in v0.126.1 starts with the following which use a ... Uncaught TypeError when accessing OrbitControls from unpkg.com.
Read more >
Why Does Three.js Need Import Maps? - Medium
An error in the browser saying Uncaught TypeError: Failed to resolve module specifier “three”. Relative references must start with either “/”, “./”, or...
Read more >
mrdoob on Twitter: "What better way to celebrate than with a ...
@unpkg. , you'll have to switch to. @skypackjs. for the time being. github.com. Uncaught TypeError when accessing OrbitControls from unpkg.com · Issue ...
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