pmndrs / react-three-fiber

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

Is it possible to use react-three-fiber with React-Native CLI application? #3208

Closed SB2318 closed 7 months ago

SB2318 commented 7 months ago

I have tried to set up it with React-Native CLI application, and came up with the following limitation.

error: Error: Unable to resolve module expo-file-system from C:\Newfolder\ReactNative3DAnim\node_modules\@react-three\fiber\native\dist\react-three-fiber-native.cjs.prod.js: expo-file-system could not be found within the project or in these directories:
  node_modules\@react-three\fiber\node_modules
  node_modules
  11 | var itsFine = require('its-fine');
  12 | var expoAsset = require('expo-asset');
> 13 | var fs = require('expo-file-system');
     |                   ^
  14 | var base64Js = require('base64-js');
  15 | var buffer = require('buffer');
  16 | require('react-reconciler/constants');
    at ModuleResolver.resolveDependency (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:138:15)
    at DependencyGraph.resolveDependency (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\node-haste\DependencyGraph.js:231:43)
    at C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\lib\transformHelpers.js:156:21
    at resolveDependencies (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\DeltaBundler\buildSubgraph.js:42:25)
    at visit (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\DeltaBundler\buildSubgraph.js:83:30)
    at async Promise.all (index 0)
    at async visit (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5)
    at async Promise.all (index 9)
    at async visit (C:\Newfolder\ReactNative3DAnim\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5)
    at async Promise.all (index 2)

React Version: 18.2.0 React-Native version: 0.73.6

In the documentation also, there is no specification for the CLI project.

Yes, with expo-project it is okay, But if I want it to integrate with my CLI project, what will be the solution?

SB2318 commented 7 months ago

Thanks again, If you consider this issue. :)