Open Bassadin opened 2 years ago
I'll leave more info.
Three.js is using a valid node exports
field, according to the node.js docs:
"exports": {
".": {
"import": "./build/three.module.js",
"require": "./build/three.cjs"
},
"./examples/fonts/*": "./examples/fonts/*",
"./examples/jsm/*": "./examples/jsm/*",
"./src/*": "./src/*"
},
in plain node.js, this import works correctly:
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
while on snowpack, the error reported above occurs.
I am also encountering this issue
I'm having the same issue Package "three" exists but package.json "exports" does not include entry for "./examples/jsm/loaders/GLTFLoader".
For a temporary fix, you can go into your local node_modules/three/package.json
and add "./examples/jsm/loaders/*": "./examples/jsm/loaders/*"
to the exports
section. That's what I've been doing
Thanks @jhsul that worked for me! I also had to add the '.js' extension to my import: import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
Quick checklist
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the bug
I'm trying to build an application with Three.js, importing a class from their examples folder. Although they have that exported in their package.json, I get an eror as decribed on the snowpack website that it isn't exported:
Package "three" exists but package.json "exports" does not include entry for "./examples/jsm/webxr/ARButton.js".
.Steps to reproduce
Link to minimal reproducible example (optional)
https://github.com/Bassadin/Three.LS