Update package.json exports paths#23354
Conversation
Related issue: - **Description** Update the export paths to include files located in the `./examples/` folder in order to include JSON fonts.
|
@marcofugaro looks good? context: https://twitter.com/bruno_simon/status/1486712639497539586 |
|
Looks good! As an alternative we could add this to the exports list: "./examples/fonts/*": "./examples/fonts/*",but maybe people are importing other stuff other than |
|
Adding only the |
|
Thanks! |
|
@mrdoob leaving this for the future (when you decide to), we could also do this for the npm users like Bruno: import { OrbitControls } from 'three/addons';
import { helvetiker_regular } from 'three/fonts';The current |
|
Not sure about fonts... Feels like As per import { OrbitControls } from 'three/addons/controls/OrbitControls';Or is there a way to "flatten" all the files in the |
|
Yeah, let's not tell people to import fonts from three hahaha
Yes, simply by adding a file similar to npm users would still import only the things they need thanks to tree-shaking.. |
D'oh! |
|
That sounds promising indeed. Do you want to get a PR going with that? |
|
Sure! Let's see what people say... |
|
So wait... Is there a way to achieve something like this? <script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.137.0/",
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { VRButton } from 'three/addons/webxr/VRButton.js';
...
</script> |
|
I assume you mean without renaming the
|
|
I was wrong, see #23368 (comment) |
|
I think we should either reconsider exporting the fonts or at least export them as |
|
@LeviPesin Context? 🤔 |
Related issue: -
Description
Update the
exportspaths to include files located in the./examples/folder like the JSON fonts.