Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: #3867

Open
1 task done
Bassadin opened this issue Feb 17, 2022 · 5 comments
Open
1 task done

🐛 BUG: #3867

Bassadin opened this issue Feb 17, 2022 · 5 comments

Comments

@Bassadin
Copy link

Quick checklist

  • I am using the latest version of Snowpack and all plugins.

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

  1. Feel free to clone my code
  2. npm install
  3. npm run build

Link to minimal reproducible example (optional)

https://github.com/Bassadin/Three.LS

@marcofugaro
Copy link

marcofugaro commented Feb 17, 2022

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.

@jhsul
Copy link

jhsul commented Feb 24, 2022

I am also encountering this issue

@sagrimson
Copy link

I'm having the same issue Package "three" exists but package.json "exports" does not include entry for "./examples/jsm/loaders/GLTFLoader".

@jhsul
Copy link

jhsul commented Mar 10, 2022

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

@sagrimson
Copy link

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';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants