import {
EventDispatcher,
...
Vector3
} from '../../../build/three.module.js';
r 137
import {
EventDispatcher,
...
Vector3
} from 'three';
leads to an error accessing three.js:
Uncaught TypeError: Error resolving the module specifier “three”. Relative module specifiers must start with “./”, “…/” or “/”.
For my collection, I always change the access and store on my server, but for my beginner example, I use the original path so that I can immediately detect errors when version change. And then I can make adjustments.
Most recently, this was the path to Text Geometry, which had changed.
Extended examples of my collection are only links, a number no longer work.
You have to add an import map to your HTML files now. In the examples, it looks like so:
Introducing from 'three'; was an important change to unify the import syntax in the web and node. However, it means you have to add an import map to your index HTML to resolve the bare import specifier three into an absolute or relative path.
It now works with Firefox, the console still shows the error message. No wonder when beginners despair. For a simple example you need some “extras” right away.
Sorry, we have to move forward and can’t wait until the last browser implements important web standards. Import maps are required for a “complete” ES6 module support.
I would love to see when developers finally file their complaints directly at Mozilla or Apple and not at individual software projects .
the situation is so weird, on one hand i feel like the fixation on “web standards” is unnatural and libraries should not try to force it, because specs will only become standards when we use them as such, and hundreds were later cast out because they didn’t have merit. if import maps will ever be used has not been decided yet. but then again, at least we’re finally not breaking npm, which is the one standard that drives javascript as a whole. so im kind of ok with shifting blame.
Discussing won’t help here, I just picked out the broken extended examples from 2021 eXtended eXamples. They are valuable examples and it would be a pity to lose them.
If you find time, feel free to update them. If I find time, I will search the previous years.