Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eadd35e

Browse files
authoredJan 19, 2022
Examples: use import maps + polyfill (mrdoob#23255)
* Examples: make esamples/jsm folder import form three * Examples: add importmap + polyfill in example files * Examples: import * as THREE from 'three' * Examples: replace missing relative imports * Examples: replace missing relative imports
1 parent fdb4b6b commit eadd35e

File tree

607 files changed

+5535
-1059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

607 files changed

+5535
-1059
lines changed
 

‎examples/css2d_label.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@
1717
<body>
1818
<div id="info"><a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> css2d - label</div>
1919

20+
<!-- Import maps polyfill -->
21+
<!-- Remove this when import maps will be widely supported -->
22+
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
23+
24+
<script type="importmap">
25+
{
26+
"imports": {
27+
"three": "../build/three.module.js"
28+
}
29+
}
30+
</script>
31+
2032
<script type="module">
2133

22-
import * as THREE from '../build/three.module.js';
34+
import * as THREE from 'three';
2335

2436
import { OrbitControls } from './jsm/controls/OrbitControls.js';
2537
import { CSS2DRenderer, CSS2DObject } from './jsm/renderers/CSS2DRenderer.js';

‎examples/css3d_molecules.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@
6464
</div>
6565
<div id="menu"></div>
6666

67+
<!-- Import maps polyfill -->
68+
<!-- Remove this when import maps will be widely supported -->
69+
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
70+
71+
<script type="importmap">
72+
{
73+
"imports": {
74+
"three": "../build/three.module.js"
75+
}
76+
}
77+
</script>
78+
6779
<script type="module">
6880

69-
import * as THREE from '../build/three.module.js';
81+
import * as THREE from 'three';
7082

7183
import { TrackballControls } from './jsm/controls/TrackballControls.js';
7284
import { PDBLoader } from './jsm/loaders/PDBLoader.js';

0 commit comments

Comments
 (0)