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

unable to show the file #19

Open
arafat1023 opened this issue Aug 10, 2020 · 2 comments
Open

unable to show the file #19

arafat1023 opened this issue Aug 10, 2020 · 2 comments

Comments

@arafat1023
Copy link

I am trying to show a .obj file.

       <OBJModel
                    width="400" height="400"
                    position={{x: 0, y: -100, z: 0}}
                    src={mayas}
                    onLoad={() => {
                        //...
                    }}
                    onProgress={xhr => {
                        //...
                    }}
                />

I am gettting this error

./static/images/Maya.obj 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # Alias OBJ Model File
| # Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited
| # File units = inches
@hugoh59
Copy link

hugoh59 commented Oct 28, 2020

Any fix?

@arafat1023
Copy link
Author

I did not use this plugin.Later i used threejs.I had to change my file loader configuration in my nextjs project.
To serve assets correctly with file-loader, configure correct location of _next static dir as following:

{
  loader: 'file-loader',
  options: {
    publicPath: "/_next/static/images", // the path access the assets via url
    outputPath: "static/images/", // where to store on disk
  }
}
webpack: (config) => {
  config.module.rules.push({
    test: /\.(glb|gltf|obj)$/,
    use: {
      loader: 'file-loader',
      options: {
        publicPath: "/_next/static/images",
        outputPath: "static/images/",
      }
    },
  });

and try to import the the file like this:
import test2 from "../../../static/images/filename.gltf";

I dont know it will work for you or not

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