pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

deprecated three js import #3153

Closed oliverlevymomentum closed 8 months ago

oliverlevymomentum commented 10 months ago

Issue

fiber/native causes warning from three js version 0.160.0

Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation

Cause

using import * as THREE from 'three'; will cause the warning because it imports:

allowed imports are

I imagine the fix would be to swap import * as THREE from 'three' to import THREE from 'three'

CodyJasonBennett commented 8 months ago

This is an issue with Metro not understanding Node resolution. You can configure it to prefer module or exports, the latter not being implemented yet to my knowledge since it has complex resolver logic.