expo / expo-three

Utilities for using THREE.js on Expo
MIT License
743 stars 90 forks source link

No Loaders working currently #108

Open evanmrose opened 5 years ago

evanmrose commented 5 years ago

Running a fresh expo init build with the following versions

 "expo": "^33.0.0",
    "expo-asset": "^5.0.0",
    "expo-constants": "^5.0.0",
    "expo-font": "^5.0.0",
    "expo-graphics": "^1.1.0",
    "expo-three": "^3.0.0-alpha.8",
    "expo-web-browser": "^5.0.0",

I've also added the following loaders per the other issues re: loading files:

"packagerOpts": {
      "assetExts": [
        "ttf",
        "mp4",
        "otf",
        "dae",
        "glb",
        "gltf",
        "fbx",
        "obj",
        "mtl",
        "amf",
        "3mf",
        "3ds",
        "jpg",
        "assimp",
        "fbx",
        "pmd",
        "vmd",
        "ply",
        "stl",
        "vtk",
        "vtp",
        "babylon",
        "drc",
        "pcd",
        "pack",
        "bvh",
        "x"
      ]
    }

The core issue is that using the exact Assets.js and file structure (Assets.js at the top level, /assets folder containing an exact copy of the one in this repo) the bundler is giving me this error:

IMG_6C3EFD110682-1

I'm thinking perhaps a cache issue or more likely...something completely goofy but I have exactly replicated the structure in this repo and it isn't working. FWIW, I tried running the /examples directory of this repo as its own app and that gave a ton of typescript errors about missing loaders and packages.

cc @EvanBacon seems like this may be on the back burner at the moment, but if you have a minute, anything come to mind that could be causing this?

BashBoss commented 5 years ago

Getting the same problem, as well, instead of using 3mf, I tried to use .obj files and .3ds files and still didnt work. Weird thing is that I copied my code to run it in a standard HTML5 website and it works straight away.

evanmrose commented 5 years ago

Yeah, none of the file types load for me either. Tried removing 3mf and the next one down the list failed as well.

mattblackdev commented 5 years ago

@EvanBacon I looked at most of the loader code briefly and it seems pretty tedious to maintain. Any chance there might be a better approach? A new strategy the community could help develop that might be leaner, easier to maintain and less coupled to all the different file extensions/types?

ghost commented 5 years ago

Dae loads for me but not glb

mattblackdev commented 5 years ago

@evanmrose I saw another issue comment that mentioned adding a metro bundler config and adding the file extensions there too. It was a while ago. Maybe packagerOpts isn’t working right now

bberak commented 5 years ago

I came across this issue as I was looking for something. I had the same problem @evanmrose, the trick that worked for me was to add a metro.config.js file in the root of the project. Here is my file:

const defaultAssetExts = require("metro-config/src/defaults/defaults").assetExts;

module.exports = {
  resolver: {
    assetExts: [
      ...defaultAssetExts,
      "glb"
    ]
  }
};

I think @mattblackdev is right with the packagerOpts not working as expected.

Hope this helps.

evanmrose commented 5 years ago

Works! @EvanBacon Would you accept a documentation update PR?

EvanBacon commented 5 years ago

@bberak great find!

Works! @EvanBacon Would you accept a documentation update PR?

@evanmrose sure.

rammmanoharsharma commented 5 years ago

Can any one please tell me how load a glb file ? Am getting error while using glb. I added metro.config.js. Can you let me know which version on expo-three supports glb

mattblackdev commented 5 years ago

Sorry, I won’t be much help other than I’ve looked at node_modules and I don’t think the current npm release has it implemented. Id like to eventually help redesign the loader to be easier to maintain. Just been busy lately and wanted to here what the maintainer thought about this.

Thanks, Matt On Jul 23, 2019, 8:20 PM -0400, rammmanoharsharma notifications@github.com, wrote:

Can any one please tell me how load a glb file ? Am getting error while using glb. I added metro.config.js. Can you let me know which version on expo-three supports glb — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.