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

Package issue: @react-three/drei exports are incorrect #189

Open
ysulyma opened this issue May 7, 2022 · 1 comment
Open

Package issue: @react-three/drei exports are incorrect #189

ysulyma opened this issue May 7, 2022 · 1 comment

Comments

@ysulyma
Copy link

ysulyma commented May 7, 2022

I am unable to import @react-three/drei/core/OrbitControls.js on jspm. The @react-three/drei package doesn't define an exports map, so I should be able to directly import any of its files. However, in the Import Map Generator the only exports I can choose from are

. [main entry]
./core/Text
./core/Text.js
./core/shaderMaterial
./core/shaderMaterial.js
./core/useContextBridge
./core/useContextBridge.js
./core/useGLTF
./core/useGLTF.js
./index.cjs.js
./index.js
./web/Html
./web/Html.js
@guybedford
Copy link
Member

@ysulyma the package exports are automatically detected by JSPM based on existing package usage on npm. Sometimes subpaths are missed.

The generated exports are at https://ga.jspm.io/npm:@react-three/[email protected]/package.json giving:

{
  "exports": "exports": {
    ".": {
      "module": "./index.js",
      "default": "./index.cjs.js"
    },
    "./web/Html": "./web/Html.js",
    "./core/useGLTF": "./core/useGLTF.js",
    "./core/useContextBridge.js": "./core/useContextBridge.js",
    "./core/useContextBridge": "./core/useContextBridge.js",
    "./core/shaderMaterial": "./core/shaderMaterial.js",
    "./core/Text": "./core/Text.js",
    "./index.cjs.js": "./index.cjs.js",
    "./index.js": "./index.js",
    "./web/Html.js": "./web/Html.js",
    "./core/useGLTF.js": "./core/useGLTF.js",
    "./core/shaderMaterial.js": "./core/shaderMaterial.js",
    "./core/Text.js": "./core/Text.js",
    "./index.cjs.js!cjs": "./index.cjs.js"
  }
}

In this case, the recommendation is:

  1. Construct a correct "exports" field for the package yourself.
  2. Post a PR to the original repo to add a correct exports field.
  3. Post a PR to the JSPM overrides repo https://github.com/jspm/overrides while that PR has not landed yet

As soon as the override is landed, the CDN rebuild will be triggered and the package should then work.

Just let me know if I can clarify further.

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

2 participants