NodeMaterial on unpkg, slow to load all the dependencies

I’m using for CDN as the installation doc says.
When I do import * as Nodes from "three/addons/nodes/Nodes.js" for NodeMaterials it takes very long time to download all the referenced js files.
Sometimes it takes 2 or 3 attempts to download because some request returns 502 Bad Gateway.

However, examples served in GitHub Pages are dealing with this relatively fine.
Is there any recommendation against the issue?

Other than “use a build system like Vite”. I’m working on a public example file for a library that should be done in a raw HTML file.

Hm. Hosting and serving them from your domain? This should require just a small change in the import map.

Have you tried other CDNs?

Nah that won’t be beautiful as an example. I want to make the html file work standalone.

I suprisingly haven’t tried yet, thank you.

  • unpkg: Described above, very slow. ~60s when cdn cache misses, 500ms when cdn cache hits. Sometimes responds 502 Bad Gateway
  • jsDelivr: Best among them. 4s when cdn cache misses, 500ms when cdn cache hits
  • cdnjs: Doesn’t work, /examples/jsm are unable to fetch
  • Skypack: Doesn't work, unable to server-side build since r157

I probably should use jsDelivr as a replacement for now.

Reported on GitHub Issue, It seems that mrdoob also agrees to switch to jsDelivr

1 Like