question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
marcofugarocommented, 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.

1reaction
jhsulcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Insect - Wikipedia
Insects (from Latin insectum) are pancrustacean hexapod invertebrates of the class Insecta. They are the largest group within the arthropod phylum.
Read more >
🐛 Bug Emoji - Emojipedia
A bug, or insect, generally depicted as a caterpillar, which becomes a 🦋 Butterfly. Shown in full profile facing left, inching up on...
Read more >
Bug & Insect Identification List NPMA's Pest Guide
This Pest Guide is a helpful tool to aid in identifying bugs, insects, and other pests. Browse a comprehensive list of bugs, insects,...
Read more >
What is a bug (computer bug)? - TechTarget
Software bugs have caused car crashes, explosions and other deadly accidents. Learn about the various types of bugs and how they can be...
Read more >
All About Bugs - YouTube
Bugs can be slimy, beautiful, tiny, squirmy, and graceful. In this story, Kai and his friend Marcus are looking for bugs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found