nwpointer / three-landscape

React-three-fiber compatible abstractions that make it easier to render high quality landscapes scenes
https://three-landscape.vercel.app
MIT License
138 stars 19 forks source link

No matching export in "node_modules/three/build/three.module.js" for import "sRGBEncoding" #35

Open Bunkerbewohner opened 6 months ago

Bunkerbewohner commented 6 months ago

Hi!

First of all, amazing library you created here! Great work! I want to play around with it a bit, but I'm having issues, I'm using these dependencies:

"devDependencies": {
    "@types/react-dom": "^18.2.25",
    "@types/three": "^0.164.0",
    "typescript": "^5.4.5"
  },
  "dependencies": {
    "@react-three/drei": "^9.105.4",
    "@react-three/fiber": "^8.16.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "three": "^0.164.1",
    "three-landscape": "^0.9.2",
    "vite": "^5.2.10"
  },

But vite is throwing errors when trying to import the library:

 No matching export in "node_modules/three/build/three.module.js" for import "sRGBEncoding"

    node_modules/three-landscape/dist/util/generateTextureArray.js:1:114:
      1 │ ...at, UnsignedByteType, LinearMipMapLinearFilter, NearestFilter, RepeatWrapping, sRGBEncoding } from "three";
        ╵       

No matching export in "node_modules/three/build/three.module.js" for import "sRGBEncoding"

    node_modules/three-landscape/dist/util/util.js:69:67:
      69 │ import { RepeatWrapping, NearestFilter, LinearMipmapNearestFilter, sRGBEncoding } from "three";

It looks like maybe THREE renamend sRGBEncoding to sRGBColorSpace and the encoding property on textures to colorSpace.

I guess the way to fix this is upgrading the dependencies of the library and making use of those new names, right? Well, I'll give it a try.

mafawu commented 22 hours ago

sRGBEncoding now is SRGBColorSpace。 参考 https://github.com/mrdoob/three.js/wiki/Migration-Guide#151--152