sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Three.js addons cannot be imported via `three/addons/*`

Open izznat opened this issue 2 years ago • 2 comments

Bug report

Packages affected

  • [ ] sandpack-client
  • [ ] sandpack-react

Description of the problem

From the Three.js docs, we should import examples from three/addons/* instead of three/examples/jsm/*. But, Sandpack bundler (non-experimental, not yet tested on the new bundler) cannot resolve exports property in the package.json. Here is the exports config of Three.js package:

{
  "name": "three",
...
  "exports": {
    ".": {
      "import": "./build/three.module.js",
      "require": "./build/three.cjs"
    },
    "./examples/fonts/*": "./examples/fonts/*",
    "./examples/jsm/*": "./examples/jsm/*",
    "./addons/*": "./examples/jsm/*",
    "./src/*": "./src/*",
    "./nodes": "./examples/jsm/nodes/Nodes.js"
  },
...
}

What were you doing when the problem occurred?

The problem happens on code load.

What steps can we take to reproduce the problem?

The problem happens on code load.

Link to sandbox: sandbox

Your Environment

Software Name/Version
Sandpack-client version
Sandpack-react version 2.0.6
Browser Chrome 110
Operating System Fedora 37

izznat avatar Feb 17 '23 23:02 izznat

@DeMoorJasper, could you please take a look at this issue? If you confirm it's a real problem on our side, we can prioritize and address it depending on how urgent it is.

danilowoz avatar Feb 20 '23 10:02 danilowoz

It works on vite template! The problem seems to be on non-nodebox runtime.

izznat avatar Feb 21 '23 16:02 izznat