Skip to content

Commit

Permalink
chore: replace the cdn, unpkg -> jsdelivr
Browse files Browse the repository at this point in the history
`unpkg.com/` -> `cdn.jsdelivr.net/npm/`

I checked all changed examples, editor, manuals are working properly

Context: unpkg is not reliable, especially when we are using NodeMaterials since there are a lot of modules to load.

See: #28002 (comment)

Note that I also replaced in `editor-settings.js`

I excluded `editor/js/libs/ffmpeg.min.js` and `examples/jsm/libs/chevrotain.module.min.js`

`webgl2_ubo_arrays.html` still imports es-module-shims, is this required?
  • Loading branch information
0b5vr committed Mar 26, 2024
1 parent 4eaa0d1 commit 00bcf3a
Show file tree
Hide file tree
Showing 38 changed files with 85 additions and 82 deletions.
3 changes: 2 additions & 1 deletion build/three.cjs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/three.module.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/three.module.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/examples/en/loaders/3DMLoader.html
Expand Up @@ -166,7 +166,7 @@ <h3>[method:Object3D load]( [param:String url], [param:Function onLoad], [param:
// Specify path to a folder containing WASM/JS libraries or a CDN.
// For example, /jsm/libs/rhino3dm/ is the location of the library inside the three.js repository
// loader.setLibraryPath( '/path_to_library/rhino3dm/' );
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.4.0/' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.4.0/' );

// Load a 3DM file
loader.load(
Expand Down Expand Up @@ -205,13 +205,13 @@ <h3>[method:Object3D parse]( [param:ArrayBuffer buffer], [param:Function onLoad]
</p>

<code>
import rhino3dm from 'https://unpkg.com/rhino3dm@8.4.0'
import rhino3dm from 'https://cdn.jsdelivr.net/npm/rhino3dm@8.4.0'

// Instantiate a loader
const loader = new Rhino3dmLoader();

// Specify path to a folder containing WASM/JS libraries or a CDN.
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.4.0' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.4.0' );

const rhino = await rhino3dm();
console.log('Loaded rhino3dm.');
Expand Down Expand Up @@ -244,7 +244,7 @@ <h3>[method:this setLibraryPath]( [param:String value] )</h3>
// Specify path to a folder containing the WASM/JS library:
loader.setLibraryPath( '/path_to_library/rhino3dm/' );
// or from a CDN:
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.4.0' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.4.0' );
</code>

<h3>[method:this setWorkerLimit]( [param:Number workerLimit] )</h3>
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/zh/loaders/3DMLoader.html
Expand Up @@ -171,7 +171,7 @@ <h3>[method:Object3D load]( [param:String url], [param:Function onLoad], [param:
// Specify path to a folder containing WASM/JS libraries or a CDN.
// For example, /jsm/libs/rhino3dm/ is the location of the library inside the three.js repository
// loader.setLibraryPath( '/path_to_library/rhino3dm/' );
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.0.1/' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1/' );

// Load a 3DM file
loader.load(
Expand Down Expand Up @@ -212,13 +212,13 @@ <h3>[method:Object3D parse]( [param:ArrayBuffer buffer], [param:Function onLoad]
</p>

<code>
import rhino3dm from 'https://unpkg.com/rhino3dm@8.0.1'
import rhino3dm from 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1'

// Instantiate a loader
const loader = new Rhino3dmLoader();

// Specify path to a folder containing WASM/JS libraries or a CDN.
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.0.1' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1' );

const rhino = await rhino3dm();
console.log('Loaded rhino3dm.');
Expand Down Expand Up @@ -251,7 +251,7 @@ <h3>[method:this setLibraryPath]( [param:String value] )</h3>
// Specify path to a folder containing the WASM/JS library:
loader.setLibraryPath( '/path_to_library/rhino3dm/' );
// or from a CDN:
loader.setLibraryPath( 'https://unpkg.com/rhino3dm@8.0.1' );
loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1' );
</code>

<h3>[method:this setWorkerLimit]( [param:Number workerLimit] )</h3>
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/ar/introduction/Installation.html
Expand Up @@ -88,7 +88,7 @@ <h2>التثبيت من CDN أو استضافة ثابتة</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -127,8 +127,8 @@ <h2>أمثلة</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/en/introduction/Installation.html
Expand Up @@ -152,8 +152,8 @@ <h3>Development</h3>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/fr/introduction/Creating-a-scene.html
Expand Up @@ -27,7 +27,7 @@ <h2>Avant de commencer</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

// Our Javascript will go here.
&lt;/script&gt;
Expand Down Expand Up @@ -129,7 +129,7 @@ <h2>Le résultat</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/fr/introduction/Installation.html
Expand Up @@ -71,7 +71,7 @@ <h2>Installer depuis un CDN ou un hébergement statique</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -110,8 +110,8 @@ <h2>Addons</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/it/introduction/Creating-a-scene.html
Expand Up @@ -30,7 +30,7 @@ <h2>Prima di iniziare</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

// Il nostro Javascript andrà qui
&lt;/script&gt;
Expand Down Expand Up @@ -147,7 +147,7 @@ <h2>Il risultato</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/it/introduction/Installation.html
Expand Up @@ -72,7 +72,7 @@ <h2>Installazione da CDN o hosting statico</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -110,8 +110,8 @@ <h2>Addons</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/ja/introduction/Creating-a-scene.html
Expand Up @@ -27,7 +27,7 @@ <h2>始める前に</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

// Our Javascript will go here.
&lt;/script&gt;
Expand Down Expand Up @@ -130,7 +130,7 @@ <h2>成果</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/ja/introduction/Installation.html
Expand Up @@ -72,7 +72,7 @@ <h2>CDNや静的ホスティングからインストールをする</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -111,8 +111,8 @@ <h2>Addons</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/ko/introduction/Creating-a-scene.html
Expand Up @@ -28,7 +28,7 @@ <h2>시작하기에 앞서</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';
´
// Our Javascript will go here.
&lt;/script&gt;
Expand Down Expand Up @@ -133,7 +133,7 @@ <h2>결과 화면</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/ko/introduction/Installation.html
Expand Up @@ -80,7 +80,7 @@ <h2>static hosting 및 CDN을 통한 설치</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -123,8 +123,8 @@ <h2>Addons</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/pt-br/introduction/Creating-a-scene.html
Expand Up @@ -27,7 +27,7 @@ <h2>Antes de começar</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

// Our Javascript will go here.
&lt;/script&gt;
Expand Down Expand Up @@ -131,7 +131,7 @@ <h2>O resultado</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/pt-br/introduction/Installation.html
Expand Up @@ -56,7 +56,7 @@ <h2>Instalar através de CDN ou hospedagem estática</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -96,8 +96,8 @@ <h2>Addons</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/ru/introduction/Creating-a-scene.html
Expand Up @@ -29,7 +29,7 @@ <h2>Прежде чем мы начнем</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

// Наш Javascript будет здесь..
&lt;/script&gt;
Expand Down Expand Up @@ -130,7 +130,7 @@ <h2>Результат</h2>
&lt;/head&gt;
&lt;body&gt;
&lt;script type="module"&gt;
import * as THREE from 'https://unpkg.com/three/build/three.module.js';
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/ru/introduction/Installation.html
Expand Up @@ -95,7 +95,7 @@ <h2>Установка с CDN или статического хостинга</
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js"
}
}
&lt;/script>
Expand Down Expand Up @@ -140,8 +140,8 @@ <h2>Дополнения</h2>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/zh/introduction/Installation.html
Expand Up @@ -151,8 +151,8 @@ <h3>开发</h3>
&lt;script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
"three": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@&lt;version&gt;/examples/jsm/"
}
}
&lt;/script>
Expand Down
4 changes: 2 additions & 2 deletions editor/index.html
Expand Up @@ -52,8 +52,8 @@
"three/addons/": "../examples/jsm/",

"three/examples/": "../examples/",
"three-gpu-pathtracer": "https://unpkg.com/three-gpu-pathtracer@0.0.19/build/index.module.js",
"three-mesh-bvh": "https://unpkg.com/three-mesh-bvh@0.7.3/build/index.module.js"
"three-gpu-pathtracer": "https://cdn.jsdelivr.net/npm/three-gpu-pathtracer@0.0.19/build/index.module.js",
"three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.7.3/build/index.module.js"
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl2_ubo_arrays.html
Expand Up @@ -100,7 +100,7 @@

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

<script type="importmap">
{
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_geometry_csg.html
Expand Up @@ -29,8 +29,8 @@
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/",
"three-mesh-bvh": "https://unpkg.com/three-mesh-bvh@0.7.3/build/index.module.js",
"three-bvh-csg": "https://unpkg.com/three-bvh-csg@0.0.16/build/index.module.js"
"three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.7.3/build/index.module.js",
"three-bvh-csg": "https://cdn.jsdelivr.net/npm/three-bvh-csg@0.0.16/build/index.module.js"
}
}
</script>
Expand Down
8 changes: 4 additions & 4 deletions examples/webgl_loader_ifc.html
Expand Up @@ -23,9 +23,9 @@
"three": "../build/three.module.js",
"three/addons/": "./jsm/",
"three/examples/jsm/utils/BufferGeometryUtils": "./jsm/utils/BufferGeometryUtils.js",
"three-mesh-bvh": "https://unpkg.com/three-mesh-bvh@0.5.23/build/index.module.js",
"web-ifc": "https://unpkg.com/web-ifc@0.0.36/web-ifc-api.js",
"web-ifc-three": "https://unpkg.com/web-ifc-three@0.0.126/IFCLoader.js"
"three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.5.23/build/index.module.js",
"web-ifc": "https://cdn.jsdelivr.net/npm/web-ifc@0.0.36/web-ifc-api.js",
"web-ifc-three": "https://cdn.jsdelivr.net/npm/web-ifc-three@0.0.126/IFCLoader.js"
}
}
</script>
Expand Down Expand Up @@ -72,7 +72,7 @@

//Setup IFC Loader
const ifcLoader = new IFCLoader();
await ifcLoader.ifcManager.setWasmPath( 'https://unpkg.com/web-ifc@0.0.36/', true );
await ifcLoader.ifcManager.setWasmPath( 'https://cdn.jsdelivr.net/npm/web-ifc@0.0.36/', true );

await ifcLoader.ifcManager.parser.setupOptionalCategories( {
[ IFCSPACE ]: false,
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_loader_texture_hdrjpg.html
Expand Up @@ -39,7 +39,7 @@
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/",
"@monogrid/gainmap-js": "https://unpkg.com/@monogrid/gainmap-js@3.0.0/dist/decode.js"
"@monogrid/gainmap-js": "https://cdn.jsdelivr.net/npm/@monogrid/gainmap-js@3.0.0/dist/decode.js"
}
}
</script>
Expand Down

0 comments on commit 00bcf3a

Please sign in to comment.